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

[kinetic] Close sockets when server responds with HTTP/1.0 #1284

Merged
merged 3 commits into from Aug 10, 2020

Conversation

mgrrx
Copy link
Contributor

@mgrrx mgrrx commented Dec 29, 2017

This PR tries to detect that the server responds with HTTP/1.0 and closes the connection accordingly in the manager.

I moved the clearing part of header_ to the end of parseResponse(). Putting setKeepOpen(false) into readHeader() didn't work for me as the internal state machine is affected by it. The header_ member is public but I couldn't find any usage of it, so I would assume that this doesn't affect anybody.

return false;
}

_response = "";

if (_header.size() < 8 || _header.find("HTTP/") != 0)
XmlRpcUtil::error("Error XmlRpcClient::parseResponse: Header does not start with protocol");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case a response is received which doesn't contain the header this patch will add a new error. Is this really necessary?

I am also not sure about if it is reasonable to change the current behavior for HTTP 1.0 connections to not-keep-them-open.

Also how does this related to #1287?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not really necessary, I can remove it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mgrrx This comment seems to be still pending.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure will do ASAP

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I simplified the state ment. I assume it does the job without introducing the new error message.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume it does the job without introducing the new error message.

Please make sure to test the latest change since this is a significant change for a distro which is already stable for 4 years (and the other comment suggests it doesn't work correctly atm).

@dirk-thomas
Copy link
Member

If #1287 gets merged should this PR be closed or still considered to be merged?

@mgrrx
Copy link
Contributor Author

mgrrx commented Sep 22, 2018

Sorry for coming back to this after so many months. Let me summarize why I think this PR still makes sense, especially for older releases:
Without #1287 (which is the case for all releases < Melodic) the rocore always responds with HTTP/1.0 and closes the connections. However, a C++ client would try to keep the connection open which in the end leads to a socket in CLOSE_WAIT as explained in #1283.

@dirk-thomas
Copy link
Member

@mgrrx Please consider retargeting a different branch. Lunar is already EOL. Either target kinetic-devel (if it should only be applied to Kinetic) or melodic-devel.

@mgrrx mgrrx changed the base branch from lunar-devel to kinetic-devel February 5, 2020 07:54
@mgrrx
Copy link
Contributor Author

mgrrx commented Feb 5, 2020

Updated as requested

@dirk-thomas dirk-thomas changed the title Close sockets when server responds with HTTP/1.0 [kinetic] Close sockets when server responds with HTTP/1.0 Feb 5, 2020
@dirk-thomas dirk-thomas merged commit 5552e8a into ros:kinetic-devel Aug 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants