Permalink
Browse files

Ensure that chunk buffer contains terminating HTTP newline

If sysread() returns content just short of the termination HTTP newline, then
the content of the chunk is removed from $chunk_buffer while eventually
leaving the HTTP newline. This breaks the invariant that $chunk_buffer will
always start with the size of the next chunk.
  • Loading branch information...
1 parent c80c7cb commit d2a5d157bfaf81ca9e70e3b8bb40977601122e2b @pmakholm pmakholm committed Mar 8, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/Starman/Server.pm
@@ -406,7 +406,7 @@ sub _prepare_env {
if ($chunk_len == 0) {
last DECHUNK;
- } elsif (length $chunk_buffer < $chunk_len) {
+ } elsif (length $chunk_buffer < $chunk_len + 2) {
$chunk_buffer = $trailer . $chunk_buffer;
last;
}

0 comments on commit d2a5d15

Please sign in to comment.