Thread View: borland.public.cppbuilder.internet.socket
6 messages
6 total messages
Started by Koen
Mon, 07 Nov 2005 14:13
Indy Http Server with chunked Post
Author: Koen
Date: Mon, 07 Nov 2005 14:13
Date: Mon, 07 Nov 2005 14:13
69 lines
2537 bytes
2537 bytes
Hi,
I use Indy 9.0.18, and have a problem with the Indy HTTP Server
(TidHTTPServer)
All the data that is send to the server, is send using the Post-method.
To specify the length of the data send, there are 2 methods:
1) Content-Length
this is working correctly
2) Transfer-Encoding: chunked
When I send data via chunked Transfer-Encoding, the server does not
recognize this, and the server only fires the OnCommandGet when the
client disconnects.
As a testapplication, I add a TidHTTPServer and a TMemo on the mainForm,
Set the server to Active in the constructor, and as OnCommandEvent, I
add following code:
//---------------------------------------------------------------------
void __fastcall TForm1::IdHTTPServer1CommandGet(TIdPeerThread *AThread,
TIdHTTPRequestInfo *RequestInfo, TIdHTTPResponseInfo *ResponseInfo)
{
Memo1->Lines->Add (RequestInfo->UnparsedParams);
ResponseInfo->ContentType = "application/text";
ResponseInfo->ContentText = RequestInfo->UnparsedParams;
}
//---------------------------------------------------------------------
when I send following data, everything works as expected:
// begin http-data
POST /path/script.cgi HTTP/1.1
From: the@email.com
User-Agent: HTTPTool/1.1
Content-Length: 6
Content-Type: text/plain
a test
// end HTTP-data
when I send chunked data however, the OnCommandGet event is only
triggered when the client disconnects, and not when all data is sent.
Off course, I cannot send a respons then:
// begin HTTP-data
POST /path/script.cgi HTTP/1.1
From: the@email.com
User-Agent: HTTPTool/1.1
Content-Type: text/plain
Transfer-Encoding: chunked
6
a test
0
// end HTTP-data
What should I do to handle chunked messages correctly?
regards,
Koen
Re: Indy Http Server with chunked Post
Author: Hans Galema
Date: Mon, 07 Nov 2005 21:20
Date: Mon, 07 Nov 2005 21:20
19 lines
1611 bytes
1611 bytes
Koen wrote: > All the data that is send to the server, is send using the Post-method. Who is the sender ? Component ? > When I send data via chunked Transfer-Encoding, the server does not > recognize this, and the server only fires the OnCommandGet when the > client disconnects. Who is to blame ? The receiver or the sender ? > What should I do to handle chunked messages correctly? Dont know. But I like to know who sends the data. Hans.
Re: Indy Http Server with chunked Post
Author: Remy Lebeau (TeamB)
Date: Mon, 07 Nov 2005 22:49
Date: Mon, 07 Nov 2005 22:49
34 lines
2167 bytes
2167 bytes
"Koen" <no@email.com> wrote in message news:Xns9707A4DC782A1noemailcom@207.105.83.66... > I use Indy 9.0.18 That is a very old version. You should consider upgrading to the current snapshot, which is 9.0.50. > and have a problem with the Indy HTTP Server (TidHTTPServer) > When I send data via chunked Transfer-Encoding, the server does not > recognize this, and the server only fires the OnCommandGet when the > client disconnects. TIdHTTPServer does not cannot recognize chunked data at all. Only TIdHTTP is written to recognize that. And even then, TIdHTTP is not written to send chunked data, either. So how exactly are you managing to send chunked data in the first place? > when I send chunked data however, the OnCommandGet event is only > triggered when the client disconnects, and not when all data is sent. That is because the missing Content-Length header causes TIdHTTPServer to read from the connnection until it disconnects. > What should I do to handle chunked messages correctly? The only way to make TIdHTTP recognize chunked data is to re-write TIdHTTPServer's source code to recognize and handle the "chunked" Transfer-Encoding header at all. Gambit
Re: Indy Http Server with chunked Post
Author: Koen
Date: Tue, 08 Nov 2005 07:00
Date: Tue, 08 Nov 2005 07:00
27 lines
1773 bytes
1773 bytes
"Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> wrote in news:436fd9fd$1@newsgroups.borland.com: > > TIdHTTPServer does not cannot recognize chunked data at all. Only > TIdHTTP is written to recognize that. And even then, TIdHTTP is not > written to send chunked data, either. So how exactly are you managing > to send chunked data in the first place? > The data is not sent by me. I do not control how the data is sent to the server. I just noticed that some clients do use chunked Transfer Encoding, and that my http server is not able to handle this. And when I read the http rfc, on www.w3.org, I can read at http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6.1 that <quote> All HTTP/1.1 applications MUST be able to receive and decode the "chunked" transfer-coding </quote> So this includes a http 1.1 Server. Unfortunatly the Indy server does not provide this feature, and I will have to implement this myself. regards, Koen
Re: Indy Http Server with chunked Post
Author: Koen
Date: Tue, 08 Nov 2005 07:09
Date: Tue, 08 Nov 2005 07:09
15 lines
1374 bytes
1374 bytes
Koen <no@email.com> wrote in news:Xns97085B888F481noemailcom@207.105.83.66: > So this includes a http 1.1 Server. Unfortunatly the Indy server does > not provide this feature, and I will have to implement this myself. > I forgot to ask another thing about this. Could you please try to tell me in which pas-file, and in which method I should add this functionality? I am not used to working in Delphi-code. regards, Koen
Re: Indy Http Server with chunked Post
Author: Remy Lebeau (TeamB)
Date: Tue, 08 Nov 2005 21:19
Date: Tue, 08 Nov 2005 21:19
11 lines
1385 bytes
1385 bytes
"Koen" <no@email.com> wrote in message news:Xns97085B888F481noemailcom@207.105.83.66... > All HTTP/1.1 applications MUST be able to receive and decode the "chunked" > transfer-coding I have forwarded a feature request to Indy's developers for this. Gambit
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads