Hi, here's a patch to make Filter::HTTPD accept more than one request
on a single connection. I've done this because I am probably going to
be using Filter::HTTPD for a thing that pretends to be a GroupDAV and/or
CalDAV server, and that needs HTTP 1.1, which requires support for
keep-alive.

Which brings me to the following question. Is there a reason to check
which method the request has, other than being able to create error
responses earlier in a few cases? Putting in all methods from
HTTP/DAV/CalDAV seems like a bad route to take. And then it would need
updating every time a new HTTP extension came around.

So, unless there is a good reason to keep doing this, I would like to
remove the method checks.


Martijn
=== trunk/lib/POE/Filter/HTTPD.pm
==================================================================
--- trunk/lib/POE/Filter/HTTPD.pm  (revision 3750)
+++ trunk/lib/POE/Filter/HTTPD.pm  (local)
@@ -161,6 +161,8 @@
   my $method = $r->method();
   if ($method eq 'GET' or $method eq 'HEAD') {
     $self->{finish}++;
+    # we are sending this back, so won't need it anymore
+    delete $self->{header};
     return [$r];
   }
 
@@ -191,6 +193,8 @@
     if (length($buf) >= $cl) {
       $r->content($buf);
       $self->{finish}++;
+      # we are sending this back, so won't need it anymore
+      delete $self->{header};
       return [$r];
     }
   }
@@ -230,6 +234,9 @@
     push @raw, join("\x0D\x0A", @headers, "") . $_->content;
   }
 
+  # allow next request after we're done sending the response
+  $self->{finish}--;
+
   [EMAIL PROTECTED];
 }
 

Reply via email to