Re: Interrupting a POST with file upload

mike cardeiro <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
> From: Torsten Förtsch <[email protected]>

>
> Best would be if you could make an educated guess based on the Content-Length 
> request header if the uploaded file will exceed the limit. Most clients send 
> an "Expect: 100-continue" header and thus give the server a chance to 
> decline 
> the request *before* the body is sent. If the body is already on the way the 
> only thing you can do is to close the connection. I don't know if httpd does 
> 
> that immediately or if it reads and discards the whole body.

> The code below is the relevant piece of CGI.pm. So, yes, the upload hook gets 
> the data as it is written to the temp file.
> 
>   while (defined($data = $buffer->read)) {
>     if (defined $self->{'.upload_hook'}) {
>       $totalbytes += length($data);
>       &{$self->{'.upload_hook'}}($filename ,$data, $totalbytes,
>                                  $self->{'.upload_data'});
>     }
>     print $filehandle $data if ($self->{'use_tempfile'});
>   }
> 


thanks for all the knowledge Torsten (and everyone else).  This stuff is the holy grail I have been looking for for years.  This is a fantastic list!


Mike Cardeiro
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.