Changeset 227
- Timestamp:
- 03/19/07 15:22:07 (2 years ago)
- Files:
-
- trunk/lib/AxKit2/Client.pm (modified) (1 diff)
- trunk/lib/AxKit2/Connection.pm (modified) (6 diffs)
- trunk/plugins/parse_post_data (modified) (1 diff)
- trunk/plugins/serve_cgi (modified) (1 diff)
- trunk/plugins/uri_to_file (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/AxKit2/Client.pm
r219 r227 223 223 sub hook_body_data_end { 224 224 my ($self, $ret) = @_; 225 if ($ret == DECLINED || $ret == DONE) { 225 print "body_data_end got: ", AxKit2::Constants::return_code($ret), "\n"; 226 if ($ret == DONE) { 226 227 return $self->process_request(); 228 } 229 elsif ($ret == DECLINED) { 230 if ($self->done_body) { 231 return $self->process_request(); 232 } 233 return 1; 227 234 } 228 235 elsif ($ret == OK) { trunk/lib/AxKit2/Connection.pm
r210 r227 57 57 continuation 58 58 keep_alive_count 59 to_read 59 60 ); 60 61 … … 98 99 99 100 $self->{headers_string} = ''; 101 $self->{to_read} = 0; 100 102 $self->{closed} = 0; 101 103 $self->{ditch_leading_rn} = 0; # TODO - work out how to set that... … … 220 222 sub close { my AxKit2::Connection $self = shift; $self->{sock_closed}++; $self->{notes} = undef; $self->SUPER::close(@_) } 221 223 224 sub done_body { 225 my AxKit2::Connection $self = shift; 226 return $self->{to_read} == 0; 227 } 228 222 229 sub event_read { 223 230 my AxKit2::Connection $self = shift; … … 226 233 if ($self->{headers_in}) { 227 234 # already got the headers... do we get a body too? 228 my $bref = $self->read( 8192);235 my $bref = $self->read($self->{to_read}); 229 236 return $self->close($!) unless defined $bref; 237 my $read_len = length($$bref); 238 $self->{to_read} -= $read_len; 230 239 return $self->hook_body_data($bref); 231 240 } … … 281 290 $self->{headers_in} = AxKit2::HTTPHeaders->new(\("GET / HTTP/1.0\r\n\r\n")); 282 291 $self->default_error_out(BAD_REQUEST); 292 } 293 294 if (my $len = $self->{headers_in}->header('Content-Length')) { 295 $self->{to_read} = $len; 283 296 } 284 297 … … 434 447 $self->{notes} = {}; 435 448 $self->{path_config} = undef; 449 $self->{to_read} = 0; 436 450 437 451 # NOTE: because we only speak 1.0 to clients they can't have trunk/plugins/parse_post_data
r223 r227 57 57 if (length($data) > $remaining) { 58 58 # IE sends extra \r\n after POST data 59 $client->push_back_read(substr($data, $remaining)); 59 60 $data =~ s/\r\n\z//; 60 61 } trunk/plugins/serve_cgi
r205 r227 78 78 my ($self, $bdata) = @_; 79 79 # TODO: Save to a temp fh. Re-open STDIN on that FH when we exec the cgi 80 return D ONE;80 return DECLINED; 81 81 } 82 82 trunk/plugins/uri_to_file
r219 r227 66 66 my $root = $self->config->path; 67 67 68 print "Root: $root\n"; 69 68 70 $uri =~ s/^\Q$root// || die "$uri did not match config path $root"; 69 71
