Hi,
In a script I receive a redirect with a POST method. There are no parameters so the request entity-body has 0 length. The https 1.1 post message generated by LWP (LWP::Protocol::http) does not include a 'Content-Length: 0' header and the server closes the connection (Netscape-Enterprise/4.1). With this header the communication works ok. IE 6 and Mozilla work this way.
Should it be considered a modification of LWP::Protocol::http or LWP::Protocol::https to incorporate this behavior?


I have made an alteration to LWP::Protocol::http request method:

--- http.pm     2003-07-08 14:07:18.000000000 -0300
+++ http.new.pm 2003-07-08 14:07:23.000000000 -0300
@@ -190,10 +190,13 @@
                push(@h, 'Content-Length' => length($$content_ref));
            }
        }
-       elsif ($clen) {
+       elsif ($clen && lc($request->method) ne 'post') {
            warn "Content-Length set when there is not content, fixed";
            hlist_remove([EMAIL PROTECTED], 'Content-Length');
-       }
+               }
+       elsif (!$clen && lc($request->method) eq 'post') {
+               push(@h, 'Content-Length' => '0');
+               }
     }

my $req_buf = $socket->format_request($method, $fullpath, @h);



Regards




Reply via email to