Skip Menu |

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

Report information
The Basics
Id: 11686
Status: open
Worked: 5 min
Priority: 0/
Queue: Net-HTTPServer

People
Owner: Nobody in particular
Requestors: mark [...] thomaszone.com
Cc:
AdminCc:

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



Subject: Problems serving .PNG files
PNG files are broken when served through Net::HTTPServer. Converting the files to GIF allows them to be served correctly. If I download a PNG through the webserver it is one byte shorter than the original PNG. (This is perl 5.8.0 on WinXP Pro). I don't have a hex editor right now (know a good one?) to be able to tell exactly which byte differs, but I'm attaching a sample PNG (a folder icon).
Download foldericon.png
image/x-png 229b
foldericon.png
Hi there, I noticed a similar behaviour when serving ZIP files under windows - do you use windows, too? However, the fix is easy: simply patch HTTPServer.pm with the attached patch file... Regards, Sini
*** HTTPServer.pm.orig Wed Jun 13 16:56:25 2007 --- HTTPServer.pm Wed Jun 13 16:56:12 2007 *************** sub _ServeFile *** 1397,1402 **** --- 1397,1404 ---- my $fileHandle = new FileHandle($fullpath); return $self->_NotFound() unless defined($fileHandle); + $fileHandle->binmode(); + my $response = new Net::HTTPServer::Response(); my ($ext) = ($fullpath =~ /\.([^\.]+?)$/);