Changeset 766
- Timestamp:
- 03/09/08 03:58:16 (2 years ago)
- Location:
- trunk
- Files:
-
- 3 modified
-
CHANGES (modified) (2 diffs)
-
lib/Perlbal/ClientProxy.pm (modified) (3 diffs)
-
t/52-chunked-upload.t (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/CHANGES
r765 r766 1 -- SECURITY: patch from Jeremey James <jbj@forbidden.co.uk> to not crash 2 on zero byte chunked upload when buffered uploads are enabled. 3 1 4 -- on successful write, update Perlbal::Socket's alive_time, so slowly 2 5 reproxied writes don't timeout the connection and kill it. Patch … … 12 15 to bring in more config; can be nested. 13 16 14 -- SECURITY -Previously a single upward directory traversal was possible17 -- SECURITY: Previously a single upward directory traversal was possible 15 18 when concat get was enabled. This behavior has been fixed in code to 16 19 match with standard file serving. -
trunk/lib/Perlbal/ClientProxy.pm
r763 r766 1021 1021 # reset our position so we start reading from the right spot 1022 1022 $self->{buoutpos} = 0; 1023 sysseek($self->{bufh}, 0, 0) ;1023 sysseek($self->{bufh}, 0, 0) if ($self->{bufh}); # But only if it exists at all 1024 1024 1025 1025 # notify that we want the backend so we get the ball rolling … … 1035 1035 my $clen = $self->{request_body_length}; 1036 1036 1037 my $sent = Perlbal::Socket::sendfile($be->{fd}, fileno($self->{bufh}), $clen - $self->{buoutpos}); 1038 if ($sent < 0) { 1039 return $self->close("epipe") if $! == EPIPE; 1040 return $self->close("connreset") if $! == ECONNRESET; 1041 print STDERR "Error w/ sendfile: $!\n"; 1042 return $self->close('sendfile_error'); 1043 } 1044 $self->{buoutpos} += $sent; 1037 if ($self->{buoutpos} < $clen) { 1038 my $sent = Perlbal::Socket::sendfile($be->{fd}, fileno($self->{bufh}), $clen - $self->{buoutpos}); 1039 if ($sent < 0) { 1040 return $self->close("epipe") if $! == EPIPE; 1041 return $self->close("connreset") if $! == ECONNRESET; 1042 print STDERR "Error w/ sendfile: $!\n"; 1043 return $self->close('sendfile_error'); 1044 } 1045 $self->{buoutpos} += $sent; 1046 } 1045 1047 1046 1048 # if we're done, purge the file and move on … … 1155 1157 sub purge_buffered_upload { 1156 1158 my Perlbal::ClientProxy $self = shift; 1159 1160 # Main reason for failure below is a 0-length chunked upload, where the file is never created. 1161 return unless $self->{bufh}; 1157 1162 1158 1163 # FIXME: it's reported that sometimes the two now-in-eval blocks -
trunk/t/52-chunked-upload.t
r617 r766 184 184 } 185 185 186 # Try a 0 length chunked request, as it used to crash server 187 { 188 my $hdr = "POST /status HTTP/1.0\r\nTransfer-Encoding: chunked\r\n\r\n0\r\n\r\n"; 189 my $sock = IO::Socket::INET->new( PeerAddr => "127.0.0.1:$port" ) 190 or return undef; 191 my $rv = syswrite($sock, $hdr); 192 die unless $rv == length($hdr); 193 194 # Give it time to crash 195 select undef, undef, undef, 1.0; 196 197 my $sock2 = IO::Socket::INET->new( PeerAddr => "127.0.0.1:$port" ); 198 ok ($sock2, 'Server still alive'); 199 } 200 186 201 1;
