mod_perl uploads

axel (archive)

Usenet Archive
Joined
Mar 30, 2001
Messages
476
Reaction score
0
Hi!

Gibt es eine Möglichkeit zu grosse Uploads abzubrechen und eine sinnvolle Fehlermeldung an den Browser zu senden, bevor die gesamten Upload Daten geparst werden?

Danke,
Axel
 

axel (archive)

Usenet Archive
Joined
Mar 30, 2001
Messages
476
Reaction score
0
Hi!

Gibt es eine Möglichkeit zu grosse Uploads abzubrechen und eine sinnvolle Fehlermeldung an den Browser zu senden, bevor die gesamten Upload Daten geparst werden?

Danke,
Axel

Sorry - I'll try it in english:
Is there a way to abort too big uploads before the whole stream gets parsed and send a meaningful message back to the client?
 

Gunnar Hjalmarsson

Usenet Archive
Joined
Apr 4, 2003
Messages
3,292
Reaction score
0
axel said:
Sorry - I'll try it in english:
Is there a way to abort too big uploads before the whole stream gets parsed and send a meaningful message back to the client?

The CPAN module CGI::UploadEasy does that.
 

axel (archive)

Usenet Archive
Joined
Mar 30, 2001
Messages
476
Reaction score
0
The CPAN module CGI::UploadEasy does that.

Just tried your module but It shows the same behaviour as CGI.pm or mod_perl:
If I upload a bigger file - the script runs until the whole file is received and then returns with:
Error
Post too large: Maxsize 300 KiB exceeded.
What I'm looking for is a way to return immediately after checking Content-Length
 

xhoster

Usenet Archive
Joined
Nov 27, 2004
Messages
2,238
Reaction score
0
axel said:
Sorry - I'll try it in english:
Is there a way to abort too big uploads before the whole stream gets parsed and send a meaningful message back to the client?

Probably not from the Perl side. Often, the web server reads the entire post before it hands it off to the CGI, and then gives the CGI a handle onto the buffered data, rather a handle to read the data directly from the network connection. So you very well may need to look for something specific either to the server itself, or to the mod_perl aspect of the server.

Xho
 

xhoster

Usenet Archive
Joined
Nov 27, 2004
Messages
2,238
Reaction score
0
Probably not from the Perl side. Often, the web server reads the entire post before it hands it off to the CGI, and then gives the CGI a handle onto the buffered data, rather a handle to read the data directly from the network connection. So you very well may need to look for something specific either to the server itself, or to the mod_perl aspect of the server.

Actually, I don't think this is possible at all using a single http connection. It seems the browser refuses to read any of the response until the server first reads the post in its entirety. (This is why CGI reads the entire post, just dumping it into /dev/null, when POST_MAX is exceeded). The server could drop the connection as soon as it realizes the post is going to be too large, but then the browser will just report a generic connection problem, rather than any specific error message you might want it to.

Xho
 

Gunnar Hjalmarsson

Usenet Archive
Joined
Apr 4, 2003
Messages
3,292
Reaction score
0
axel said:
Just tried your module but It shows the same behaviour as CGI.pm or mod_perl:
If I upload a bigger file - the script runs until the whole file is received

Yes, the whole request will be transmitted before you'll be able to check content-length. Note that you asked about abortion before it gets _parsed_, not before it's _transmitted_.
 

axel (archive)

Usenet Archive
Joined
Mar 30, 2001
Messages
476
Reaction score
0
Yes, the whole request will be transmitted before you'll be able to check content-length. Note that you asked about abortion before it gets _parsed_, not before it's _transmitted_.

Ok, my mistake, I ment _transmitted_.
But with modperl FilterConnectionHandler I thought it to be possible to examine the header before the tranfer is done. Unfortunately I can't get this kind of handler be called with my configuration... But if it is true that the browser doesn't accept a custom response before the transfer is done I must use a simple reject. Thanks, Axel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,051
Messages
3,104,251
Members
248,135
Latest member
tobystanx

Latest Threads

Top