Connection closed too early - incomplete response?
Posted: Fri Sep 18, 2015 1:54 am
Greetings .*,
I've run into a problem of which I'm unsure if I understand it correctly, and so far failed to fix. For larger levels, I only receive a part of the page before the server closes the connection. (When I check in Firefox, it seems to have no problem and gets the full thing.)
At first I expected a bug in my code, but then I tried sending my request with netcat and that also reproduced it.
With request.txt as
and the command
the response body is cut off somewhere inside the first copy of the level description.
Putting printfs into my code, to output the expected and received chunk lengths, this is what I get:
That is, of about 131.8kB, only the first (exactly) 64kB are transferred and then the connection is closed, leaving about 67.8kB still missing.
Is this a hard-limit configured into the server? Or is there something I can do to fix this?
(One thing I could try to do is send the "Accept-Encoding: gzip" header, which should reduce the size a lot (with the whole level description being included twice and the map being essentially just a bitmap.) Maybe this is why it works in Firefox... But that's more work that I'd like to avoid if there's a simpler fix.)
I've run into a problem of which I'm unsure if I understand it correctly, and so far failed to fix. For larger levels, I only receive a part of the page before the server closes the connection. (When I check in Firefox, it seems to have no problem and gets the full thing.)
At first I expected a bug in my code, but then I tried sending my request with netcat and that also reproduced it.
With request.txt as
Code: Select all
GET /runaway/index.php?gotolevel=500 HTTP/1.1
User-Agent: netcat
Connection: close
Cookie: phpbb2mysql_data=...*snip*
Host: www.hacker.org
Code: Select all
cat request.txt | nc www.hacker.org 80
Putting printfs into my code, to output the expected and received chunk lengths, this is what I get:
Code: Select all
remaining expected received errmsg
134977 2048 2048 null
132929 2048 2048 null
130881 2048 2048 null
128833 2048 2048 null
126785 2048 2048 null
124737 2048 2048 null
122689 2048 2048 null
120641 2048 2048 null
118593 2048 2048 null
116545 2048 2048 null
114497 2048 2048 null
112449 2048 2048 null
110401 2048 2048 null
108353 2048 2048 null
106305 2048 2048 null
104257 2048 2048 null
102209 2048 2048 null
100161 2048 2048 null
98113 2048 2048 null
96065 2048 2048 null
94017 2048 2048 null
91969 2048 2048 null
89921 2048 2048 null
87873 2048 2048 null
85825 2048 2048 null
83777 2048 2048 null
81729 2048 2048 null
79681 2048 2048 null
77633 2048 2048 null
75585 2048 2048 null
73537 2048 2048 null
71489 2048 2048 null
69441 2048 0 closed
Is this a hard-limit configured into the server? Or is there something I can do to fix this?
(One thing I could try to do is send the "Accept-Encoding: gzip" header, which should reduce the size a lot (with the whole level description being included twice and the map being essentially just a bitmap.) Maybe this is why it works in Firefox... But that's more work that I'd like to avoid if there's a simpler fix.)