> Anyone has complained that he cannot send an empty data > using the POST or PUT method?
Well, I have one of my apps that doesn't work in some wases: when data to send is empty. And it is perfectly OK for the app to have a post with empty data. And I can't change the post to a get since the server side has a script that handle post only. So I plan to change the component to allow empty content to be sent. It is perfectly legal in the HTTP protocol to do that. Just send content-length equal to zero and everything is OK. -- [EMAIL PROTECTED] http://www.overbyte.be ----- Original Message ----- From: "Maurizio Lotauro" <[EMAIL PROTECTED]> To: "ICS support mailing" <twsocket@elists.org> Sent: Sunday, March 20, 2005 12:00 AM Subject: Re: [twsocket] HTTP client: what about posting zero bytes ? > On 19-Mar-05 18:43:39 Francois PIETTE wrote: > > >Actually, THttpCli.DoRequestAsync is implemented to trigger an exception if > >there is nothing to POST/PUT: > > > if ((Rq = httpPOST) or (Rq = httpPUT)) and > > (not Assigned(FSendStream) or > > (FSendStream.Position = FSendStream.Size)) then > > raise EHttpException.Create('HTTP component has nothing to post or > >put', > > httpErrNoData); > > >I wonder if I should suppress this test (except not Assigned(FSendStream)) > >so that empty data can be sent. > >Any opinion ? > > IIRC the original test was (FSendStream.Size = 0). > > The real question is if sending empty data (with the exception of > authentication phases but this is handled automatically) make sense > or not. I think no because in that case the GET could be used instead > of POST, but I'm not an http expert. > > My observation is that this test will catch a common error, i.e the > stream is not "rewinded" when used a second time. > > Anyone has complained that he cannot send an empty data using the > POST or PUT method? > > A limit that I noticed about this topic is that actually it is not > possible to tell the component to not send the entire content of the > SendStream starting from the actual position. > > BTW, the test on Rc can be changed in (Rq in [httpPost, httpPut]) > > > Bye, Maurizio. > > > -- > To unsubscribe or change your settings for TWSocket mailing list > please goto http://www.elists.org/mailman/listinfo/twsocket > Visit our website at http://www.overbyte.be > -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be