Skip Menu |

This queue is for tickets about the HTTP-Lite CPAN distribution.

Report information
The Basics
Id: 2894
Status: resolved
Priority: 0/
Queue: HTTP-Lite

People
Owner: help [...] thetoybox.org
Requestors: pdenis [...] fotango.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: Content-Type missing in POST request
It seems that the "Content-Type" header is not send in POST requests. This prevents a POST request to be parsed by most servers. I've enclosed a patch that adds this header in case of a POST. The code could be simplified. The patch also fix the warning due to a duplicate line as exposed in previous bug report. I hope this helps
70c70 < my $self=shift; --- > my $self = shift; 72,73c72 < my $method = uc($method); < $self->{method} = $method; --- > $self->{method} = uc $method; 196a196,199 > } > > if ($method eq 'POST') { > http_write(*FH, "Content-Type: application/x-www-form-urlencoded$CRLF");
I have found a performance problem when POSTing several Mo files, this could take several minutes to encode on a decent machine. I've enclosed a patch which optimize the encoding speed significantly.
70c70 < my $self=shift; --- > my $self = shift; 72,73c72 < my $method = uc($method); < $self->{method} = $method; --- > $self->{method} = uc $method; 102,103c101 < $toencode=~s/([^a-zA-Z0-9_.-])/uc sprintf("%%%02x",ord($1))/eg; < return $toencode; --- > join '', map {uc sprintf "%%%02x", ord} split '', $toencode; 196a195,198 > } > > if ($method eq 'POST') { > http_write(*FH, "Content-Type: application/x-www-form-urlencoded$CRLF");