Item1471: HTTPEngineContrib - Initial release

pencil
Priority: Normal
Current State: Being Worked On
Released In:
Target Release: n/a
Applies To: Extension
Component: HTTPEngineContrib
Branches:
Reported By: GilmarSantosJr
Waiting For: Main.GilmarSantosJr
Last Change By: GilmarSantosJr
Task related to HTTPEngineContrib intial release.

-- GilmarSantosJr - 19 Apr 2009

Currently the code is broken. Use it from HTTPEngineContrib:d4d2ce345dc3 with the following patch:

diff --git a/HTTPEngineContrib/lib/Foswiki/Engine/HTTP/Protocol.pm b/HTTPEngineContrib/lib/Foswiki/Engine/HTTP/Protocol.pm
index a83a205..8fb0759 100644
--- a/HTTPEngineContrib/lib/Foswiki/Engine/HTTP/Protocol.pm
+++ b/HTTPEngineContrib/lib/Foswiki/Engine/HTTP/Protocol.pm
 -72,6 +72,8 @@ sub options {
         $prop->{$_} ||= undef;
         $ref->{$_} = \$prop->{$_};
     }
+
+    $prop->{log_file} = '';
 }

 sub default_values {
diff --git a/HTTPEngineContrib/lib/Foswiki/Engine/HTTP/Static.pm b/HTTPEngineContrib/lib/Foswiki/Engine/HTTP/Static.pm
index 590ee80..6d0ff05 100644
--- a/HTTPEngineContrib/lib/Foswiki/Engine/HTTP/Static.pm
+++ b/HTTPEngineContrib/lib/Foswiki/Engine/HTTP/Static.pm
 -14,6 +14,7 @@ sub new {
     my $class = shift;
     my $this = bless {@_}, ref($class) || $class;
     $this->{method} = uc( $this->{method} );
+    return $this;
 }

 sub send_response {
 -88,7 +89,7 @@ sub _write {
           . $headers->as_string($CRLF)
           . $CRLF;
     }
-    if ( $code == 200 && $this->{proto} eq 'GET' ) {
+    if ( $code == 200 && $this->{method} eq 'GET' ) {
         binmode $fh;
         while ( sysread( $fh, my ($buffer), 4096 ) ) {
             last

  • It only works for 127.0.0.1:8080 (or any other IP:port you put in Foswiki::Engine::HTTP::run)
    • Adjust {DefaultUrlHost} accordingly
    • Foswiki must be already configured (tip you can use tools/lighttpd.pl to run configure)
  • Some more hard coded values are set in Foswiki::Engine::HTTP::Protocol
  • ALERT! There is no CGI support (configure doesn't work, neither any legacy extension that adds files to foswiki bin directory)

As soon as I can I'll continue the development.

-- GilmarSantosJr - 30 Aug 2009

Pending Tasks

  • DONE Make foswiki_http.pl to be runnable without LocalSite.cfg
  • DONE Refactor Foswiki::Engine::HTTP::Server::readHeader() to Foswiki::Engine::Util::readHeader(), so it can be shared by http protocol handling and cgi processing
  • DONE Refactor Foswiki::Engine::HTTP::Server::readBody() to Foswiki::Engine::HTTP::Util::readBody() (same reason as above)
  • wip Add support for CGI scripts (then configure will be usable)
  • Add restart feature to apply LocalSite.cfg updates
  • Add logging
  • Write documentation

-- GilmarSantosJr - 30 Nov 2009
Topic revision: r13 - 01 Dec 2009, GilmarSantosJr
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy