-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a Trailer header exception, add a big header test case
- Loading branch information
Showing
3 changed files
with
48 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env perl | ||
use strict; | ||
use Test::More; | ||
use File::Temp (); | ||
use File::Temp qw/ :seekable /; | ||
use Hijk; | ||
use Test::Exception; | ||
|
||
my $fh = File::Temp->new(); | ||
my $fd = do { | ||
local $/ = undef; | ||
my $data = "4\r\nWiki\r\n5\r\npedia\r\ne\r\n in\r\n\r\nchunks.\r\n0\r\n\r\n"; | ||
|
||
my $msg = join( | ||
"\x0d\x0a", | ||
'HTTP/1.1 200 OK', | ||
'Date: Sat, 23 Nov 2013 23:10:28 GMT', | ||
'Last-Modified: Sat, 26 Oct 2013 19:41:47 GMT', | ||
'ETag: "4b9d0211dd8a2819866bccff777af225"', | ||
'Content-Type: text/html', | ||
'Server: Example', | ||
'Transfer-Encoding: chunked', | ||
'Trailer: Date', | ||
'non-sence: ' . 'a' x 20000, | ||
'', | ||
$data, | ||
'Date: Sat, 23 Nov 2013 23:10:28 GMT', | ||
'' | ||
); | ||
print $fh $msg; | ||
$fh->flush; | ||
$fh->seek(0, 0); | ||
fileno($fh); | ||
}; | ||
|
||
throws_ok { | ||
my ($proto, $status, $body, $head) = Hijk::read_http_message($fd); | ||
} qr /trailer/i; | ||
|
||
done_testing; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters