Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TCP fragments not being rejoined #10

Open
n8henrie opened this issue Sep 14, 2015 · 0 comments
Open

TCP fragments not being rejoined #10

n8henrie opened this issue Sep 14, 2015 · 0 comments

Comments

@n8henrie
Copy link

Apologies in advance for improper terminology, I know next to nothing about TCP / IP / ICMP.

I think I have figured out that an issue I thought was with Espduino is actually a problem with how this library handles TCP fragments.

Based on tcpdump, it looks like some local servers I've been using for testing purposes split their response and end up with the HTTP/1.1 200 OK in one TCP fragment and the remainder of the fragment separately. Using the exact same app (e.g. with Python Flask, but also tested with others), if the TCP fragment is split up this way, any other browser or curl is able to reassemble the packets and gets a whole response, but my Espduino only gets the contents of the first packet, after which it waits 5 seconds and times out, reporting a 0 response code.

I added a line to the tcpclient_recv function in rest.c to help debug:

INFO("DEBUG:\n%s\n\n", pdata);

And the output as I anticipated is EXTRA DEBUG: HTTP/1.1 200 OK (but nothing else) when the TCP packet is split (they consistently end up getting split right after this part, with the remainder of headers and the body in the next packet).

When the TCP packet is not split (because I'm serving through nginx or mitmproxy, which join the split packets), the response for the exact same code is:

EXTRA DEBUG: HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Content-Length: 38
this: that
Server: Werkzeug/0.10.4 Python/3.4.3
Date: Mon, 14 Sep 2015 07:17:15 GMT

<html><body>hello world!</body></html>

I'm going to work on trying to figure out why it isn't handling split packets like other apps do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant