You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Andreas Frisch <fr...@opendreambox.org> on 2013/12/06 15:13:56 UTC

[users@httpd] cgi-bin disconnecting upload

Hi, I have a peer that does an HTTP PUT using curl to my apache 2.2.25 
running a cgi written in c.
Under certain conditions, the cgi-bin terminates with an HTTP error 
status, like 400. This will keep a file from being uploaded as expected.
However, when the content-length of the upload is unspecified, the 
uploading peer doesn't receive this error status until it's actually done 
transmitting the entire upload.
This is a problem when PUTting a continuous stream because the peer 
will never notice that the server actually denied receiving the stream.
Is there a way to forcefully disconnect the client from within the cgi-bin or 
keep apache from sending the 100 - continue statement right away?
Maybe somebody has another idea of how to work around this.
There's a minimal example for testing this scenario in the attachment.

Thanks for your help!
--Fraxinas

Re: [users@httpd] cgi-bin disconnecting upload

Posted by Andreas Frisch <fr...@opendreambox.org>.
> Under what criteria, missing Content-Length? You can probably set 
that
> up more directly w/ e.g. mod_rewrite.

I'm not sure whether I understand that right.
Does the question refer to which exact case the 100-Continue status 
shouldn't be sent? 
--That would be in case my cgi-bin determines that the client is not 
supposed to do the HTTP PUT operation.
And I could use a mod_rewrite rule to specify the 100-Continue not to be 
sent? I guess that would apply for every connection then, and not be 
dynamically determinable from within the cgi-bin, right?

> 
> If a 100-continue isn't answered, a client could just as well send it
> the body anyway:
> 
 
I have control over the peer's code, so I could decide how to handle this.

A different problem is that andybody could just use curl or whatever to do 
continuous PUT operations with nonsense content and overload the 
server that way... is there really now way how to keep that from 
happening?
Maybe with some apache module? 


Re: [users@httpd] cgi-bin disconnecting upload

Posted by Eric Covener <co...@gmail.com>.
On Fri, Dec 6, 2013 at 9:24 AM, Andreas Frisch
<fr...@opendreambox.org> wrote:
>> > or keep apache from sending the 100 - continue statement right away?
>
>>
>
>> What would it do instead?
>
>>
>
> Ιf it didn't send the continue at all, then at least the client side could
> detect a timeout and interrupt the upload itself rather than just keep
> sending data forever that apache has to discard.

Under what criteria, missing Content-Length? You can probably set that
up more directly w/ e.g. mod_rewrite.

If a 100-continue isn't answered, a client could just as well send it
the body anyway:

Because of the presence of older implementations, the protocol allows
   ambiguous situations in which a client may send "Expect: 100-
   continue" without receiving either a 417 (Expectation Failed) status
   or a 100 (Continue) status. Therefore, when a client sends this
   header field to an origin server (possibly via a proxy) from which it
   has never seen a 100 (Continue) status, the client SHOULD NOT wait
   for an indefinite period before sending the request body.



-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] cgi-bin disconnecting upload

Posted by Andreas Frisch <fr...@opendreambox.org>.
> > or keep apache from sending the 100 - continue 
statement right away?
> 
> What would it do instead?
>
Ιf it didn't send the continue at all, then at least the 
client side could detect a timeout and interrupt the 
upload itself rather than just keep sending data 
forever that apache has to discard.

Re: [users@httpd] cgi-bin disconnecting upload

Posted by Eric Covener <co...@gmail.com>.
> or keep apache from sending the 100 - continue statement right away?

What would it do instead?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org