Home » U++ Library support » U++ MT-multithreading and servers » [FIXED]HttpRequest hangs when Chunked response, without trailer, and KeepAlive is set. (patch & TC)
Re: [BUG]HttpRequest hangs when Chunked response, without trailer, and KeepAlive is set. (patch & TC) [message #46325 is a reply to message #46292] |
Tue, 19 April 2016 11:42 |
omari
Messages: 266 Registered: March 2010
|
Experienced Member |
|
|
here a test case for chunker response with and without trailer:
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
// base source : http://www.tcpipguide.com/free/t_HTTPDataLengthIssuesChunkedTransfersandMessageTrai-3.htm
String chunked_with_trailer = "HTTP/1.1 200 OK\r\nDate: Mon, 22 Mar 2004 11:15:03 GMT\r\nContent-Type: text/html\r\nTransfer-Encoding: chunked\r\nTrailer: Expires\r\n\r\n29\r\n<html><body><p>The file you requested is \r\n5\r\n3,400\r\n23\r\nbytes long and was last modified:\r\n\r\n1d\r\nSat, 20 Mar 2004 21:12:00 GMT\r\n13\r\n.</p></body></html>\r\n0\r\nExpires: Sat, 27 Mar 2004 21:12:00 GMT\r\n\r\n";
// base source : https://en.wikipedia.org/wiki/Chunked_transfer_encoding?oldid=430331176
String chunked_without_trailer = "HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\nTransfer-Encoding: chunked\r\n\r\n26\r\nThis is the data in the first chunk\r\n6\r\n1C\r\nand this is the second one\r\n\r\n3\r\ncon\r\n8\r\nsequence\r\n0\r\n\r\n";
static void Server(String r)
{
TcpSocket server;
if(server.Listen(4000, 10)) {
TcpSocket socket;
LOG("Waiting...");
bool b = socket.Accept(server);
if(b) {
LOG("Connection accepted");
HttpHeader http;
http.Read(socket);
socket.Put(r);
socket.Close();
}
}
}
GUI_APP_MAIN
{
StdLogSetup(LOG_COUT|LOG_FILE);
Thread a;
LOG("chunked_without_trailer");
LOG("****************");
LOG(chunked_without_trailer);
LOG("---------------");
a.Run(callback1(Server, chunked_without_trailer));
HttpRequest r1("localhost:4000");/*r1.Trace();*/ LOG(r1.GET().Execute());
a.Wait();
LOG("chunked_with_trailer");
LOG("****************");
LOG(chunked_with_trailer);
LOG("---------------");
a.Run(callback1(Server, chunked_with_trailer));
HttpRequest r2("localhost:4000");/*r2.Trace();*/ LOG(r2.GET().Execute());
a.Wait();
LOG("=============== OK");
}
regards
omari.
|
|
|
|
|
[FIXED]HttpRequest hangs when Chunked response, without trailer, and KeepAlive is set. (patch & TC)
By: omari on Fri, 08 April 2016 19:44
|
|
|
Re: [BUG]HttpRequest hangs when Chunked response, without trailer, and KeepAlive is set. (patch & TC)
By: mirek on Sun, 17 April 2016 08:58
|
|
|
Re: [BUG]HttpRequest hangs when Chunked response, without trailer, and KeepAlive is set. (patch & TC)
By: omari on Sun, 17 April 2016 11:37
|
|
|
Re: [BUG]HttpRequest hangs when Chunked response, without trailer, and KeepAlive is set. (patch & TC)
By: mirek on Sun, 17 April 2016 14:43
|
|
|
Re: [BUG]HttpRequest hangs when Chunked response, without trailer, and KeepAlive is set. (patch & TC)
By: omari on Sun, 17 April 2016 22:10
|
|
|
Re: [BUG]HttpRequest hangs when Chunked response, without trailer, and KeepAlive is set. (patch & TC)
By: mirek on Mon, 18 April 2016 17:44
|
|
|
Re: [BUG]HttpRequest hangs when Chunked response, without trailer, and KeepAlive is set. (patch & TC)
By: omari on Mon, 18 April 2016 19:02
|
|
|
Re: [BUG]HttpRequest hangs when Chunked response, without trailer, and KeepAlive is set. (patch & TC)
By: mirek on Tue, 19 April 2016 11:01
|
|
|
Re: [BUG]HttpRequest hangs when Chunked response, without trailer, and KeepAlive is set. (patch & TC)
By: omari on Tue, 19 April 2016 11:36
|
|
|
Re: [BUG]HttpRequest hangs when Chunked response, without trailer, and KeepAlive is set. (patch & TC)
By: mirek on Fri, 22 April 2016 09:33
|
|
|
Re: [BUG]HttpRequest hangs when Chunked response, without trailer, and KeepAlive is set. (patch & TC)
By: omari on Fri, 22 April 2016 17:08
|
|
|
Re: [BUG]HttpRequest hangs when Chunked response, without trailer, and KeepAlive is set. (patch & TC)
By: mirek on Mon, 25 April 2016 13:52
|
|
|
Re: [BUG]HttpRequest hangs when Chunked response, without trailer, and KeepAlive is set. (patch & TC)
By: mirek on Mon, 25 April 2016 13:57
|
|
|
Re: [BUG]HttpRequest hangs when Chunked response, without trailer, and KeepAlive is set. (patch & TC)
By: omari on Tue, 19 April 2016 11:42
|
Goto Forum:
Current Time: Sat May 11 23:35:44 CEST 2024
Total time taken to generate the page: 0.02726 seconds
|