Skip Menu |
 

This queue is for tickets about the Net-Server CPAN distribution.

Report information
The Basics
Id: 116325
Status: new
Priority: 0/
Queue: Net-Server

People
Owner: Nobody in particular
Requestors: stephen.baynes [...] smoothwall.net
Cc:
AdminCc:

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



Subject: Net::Server::HTTP Location header and duplicate HTTP lines
Date: Tue, 19 Jul 2016 17:22:42 +0100
To: bug-Net-Server [...] rt.cpan.org
From: Stephen Baynes <stephen.baynes [...] smoothwall.net>
If my server outputs both a HTTP line and a Location header, then Net::Server::HTTP tries to output two HTTP lines. For example the following server: #!/usr/bin/perl use Net::Server::HTTP; use base qw(Net::Server::HTTP); __PACKAGE__->run( port => "8080", background => undef, ); sub process_http_request { print join("\015\012", "HTTP/1.0 302 Found", "Location: http://somewhere.else/", "", "BODY", ); } When requesting a response one gets: $ curl -i localhost:8080 HTTP/1.0 302 bouncing Date: Tue Jul 19 15:57:19 2016 GMT Connection: close Server: Net::Server::HTTP/2.007 HTTP/1.0 302 Found Location: http://somewhere.else/ BODY You can see two HTTP/1.0 lines above. This is because Net::Server::HTTP;sets a 302 status when it sees a Location header, regardless of if it already has sees a HTTP line. Seen in 2.007 version on Ubuntu. Relevant code looks unchanged in 2.008. Fix is probably something like changing: $headers->{'status'} = [302, 'bouncing'] to: $headers->{'status'} //= [302, 'bouncing']


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.