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

HTTP client doesn't close connection if connection type is close. #10

Open
VincentDeHaen opened this issue Jan 19, 2016 · 1 comment
Open
Labels

Comments

@VincentDeHaen
Copy link

HTTP trace:
GET /plugin/CILamp/jobs?MAC=02-BA-BE-BA-BE-02 HTTP/1.1
Host: 192.168.3.1:8080
User-Agent: picoTCP
Connection: Close

HTTP/1.1 200 OK
X-Content-Type-Options: nosniff
Content-Type: text/html;charset=UTF-8
Connection: close
Server: Jetty(winstone-2.9)

{"Name":"jelly","Colour":"Green","Flash":"SOLID"}

In Wireshark:
jenkinsnotnice

The client acknowledges the response and then the connection stays open. If I read the RFC rules right client should close the connection himself (correct me if i'm wrong). Most of the servers do this by themselves and then there are no problems.

These packages were captured using a Jenkins server and the lamp application.
I'm using very similar code as the one provided in the User Documentation.
Is there a way to solve this?

@robbinvandamme
Copy link
Contributor

No, you are correct:
A client that sends a "close" connection option MUST NOT send further
requests on that connection (after the one containing "close") and
MUST close the connection after reading the final response message
corresponding to this request.

So we need to call:
pico_http_client_close(client->connectionID);
after the client-app has read the response. (somewhere around line 1860 in "if (client->body_read_done)")

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

No branches or pull requests

2 participants