Skip Menu |

This queue is for tickets about the HTTP-Server-Simple-Static CPAN distribution.

Report information
The Basics
Id: 20534
Status: resolved
Priority: 0/
Queue: HTTP-Server-Simple-Static

People
Owner: sjq-perl [...] jadevine.org.uk
Requestors: tom@eborcom.com (no email address)
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.03
Fixed in: (no value)



Subject: Failure to send CRLF after HTTP header fields
Currently, HTTP::Server::Simple::Static sends "\n" to separate header fields. Section 4.1 Message Types of RFC 2616 states that CRLF should separate header fields. The attached patch uses the approach recommended in perlport(1) to accomplish this. The patch also adds the "use bytes" pragma to ensure Content-Length contains the number of bytes in the response body, not the number of characters.
Subject: HTTP-Server-Simple-Static.patch
diff -ruN HTTP-Server-Simple-Static-0.03.old/lib/HTTP/Server/Simple/Static.pm HTTP-Server-Simple-Static-0.03/lib/HTTP/Server/Simple/Static.pm --- HTTP-Server-Simple-Static-0.03.old/lib/HTTP/Server/Simple/Static.pm Tue Jun 13 11:02:25 2006 +++ HTTP-Server-Simple-Static-0.03/lib/HTTP/Server/Simple/Static.pm Tue Jul 18 11:33:11 2006 @@ -38,9 +38,10 @@ my $mime = ($mimeobj ? $mimeobj->type : $magic->checktype_contents($content)); - print "HTTP/1.1 200 OK\n"; - print "Content-type: " . $mime . "\n"; - print "Content-length: " . length($content) . "\n\n"; + use bytes; # Content-Length in bytes, not characters + print "HTTP/1.1 200 OK\015\012"; + print "Content-type: " . $mime . "\015\012"; + print "Content-length: " . length($content) . "\015\012\015\012"; print $content; return 1; }
CC: tom [...] eborcom.com
Subject: Re: [rt.cpan.org #20534] Failure to send CRLF after HTTP header fields
Date: Wed, 19 Jul 2006 14:04:19 +0100
To: bug-HTTP-Server-Simple-Static [...] rt.cpan.org
From: "Stephen Quinney" <sjq-perl [...] jadevine.org.uk>
On 18/07/06, tom@eborcom.com via RT <bug-HTTP-Server-Simple-Static@rt.cpan.org> wrote: Show quoted text
> > Currently, HTTP::Server::Simple::Static sends "\n" to separate header > fields. Section 4.1 Message Types of RFC 2616 states that CRLF should > separate header fields. > > The attached patch uses the approach recommended in perlport(1) to > accomplish this. > > The patch also adds the "use bytes" pragma to ensure Content-Length > contains the number of bytes in the response body, not the number of > characters.
Thanks for the bug report and patch. I'll try to get a new version out soon. Stephen Quinney
From: sjq-perl [...] jadevine.org.uk
On Tue Jul 18 10:35:56 2006, tom@eborcom.com wrote: Show quoted text
> Currently, HTTP::Server::Simple::Static sends "\n" to separate header > fields. Section 4.1 Message Types of RFC 2616 states that CRLF should > separate header fields. > > The attached patch uses the approach recommended in perlport(1) to > accomplish this. > > The patch also adds the "use bytes" pragma to ensure Content-Length > contains the number of bytes in the response body, not the number of > characters.
I've now applied your patch and uploaded version 0.04 of HTTP::Server::Simple::Static to CPAN. Thanks, Stephen Quinney