Subject: | No UTF8 Filenames in the header? |
I have trouble with Jetty (Server) and UTF-8 filename but it works with
all browers (firefox, chrome ...)
Please fix this Bug/Problem, thanks.
And have trouble with false headers example:
HTTP/1.1 200 OK
Date: Sun, 12 Jun 2011 06:08:15 GMT
Transfer-Encoding: chunked
Cache-C
Pragma: public
Expires: 0
...
Output:
Filename:
request: 200 OK
Cache-Control: must-revalidate, post-check=0, pre-check=0, private=false
Date: Sun, 12 Jun 2011 06:08:15 GMT
Pragma: public
Accept-Ranges: bytes
Server: Jetty(6.1.16)
Content-Length: 0
Content-Type: application/force-download
Expires: 0
Content-Disposition: attachment; filename*= UTF-8''G3hvsWYWda.part1.rar
Content-Transfer-Encoding: binary
Keep-Alive: 1000
X-HTTP-Version: 1.1
Testscript:
#!/usr/bin/perl
my $newhead = "HTTP/1.1 200 OK
Date: Sun, 12 Jun 2011 06:08:15 GMT
Pragma: public
Expires: 0
Cache-Control: must-revalidate, post-check=0, pre-check=0, private=false
Content-Type: application/force-download
Content-Transfer-Encoding: binary
Keep-Alive: 1000
Content-Disposition: attachment; filename*= UTF-8''G3hvsWYWda.part1.rar
Accept-Ranges: bytes
Content-Length: 0
Server: Jetty(6.1.16)
";
#$newhead =~ s/filename\*= UTF-8''/filename = /ig;#Dirty fast fix
#for other problems with the modul with dirty fixes
#$newhead =~ s/Transfer-Encoding:\s*chunked(?:[\r\n]|$)//i;
#$newhead =~ s/[^C]*Content-Transfer-Encoding:\s*binary(?:[\r\n]|$)//i;
#$newhead =~ s/Cache-C(?:[\r\n]|$)//i;
#$newhead =~ s/Acc(?:[\r\n]|$)//i;
#
use HTTP::Parser;
my $parser = HTTP::Parser->new(response => 1);
my $status = $parser->add($newhead);
my $response = $parser->object;
print "Filename: ".$response->filename."\n";#No output (filename) with
UTF-8''...
if(0 == $status){
print "request: ".$parser->request()->as_string(); # HTTP::Request
}elsif(-3 == $status){
print "no content length header!\n";
}elsif(-2 == $status){
print "need a line of data\n";
}elsif(-1 == $status){
print "need more data\n";
}else{# $status > 0
print "need $status byte(s)\n";
}
exit;