Skip to content

Reset queryParameterString when the current session doesn't have a query.#657

Open
kaishi05 wants to merge 1 commit intoNanoHttpd:masterfrom
kaishi05:patch-1
Open

Reset queryParameterString when the current session doesn't have a query.#657
kaishi05 wants to merge 1 commit intoNanoHttpd:masterfrom
kaishi05:patch-1

Conversation

@kaishi05
Copy link

In HTTP 1.1, connection is reused across HTTP connection (aka HTTP session in nanohttpd). See the connection reuse codes in ClientHandler where HTTPSession is reused by calling execute() in a while loop.

However, in HTTPSession, queryParameterString is not cleaned up correctly across sessions when a previous session has a query while the current one doesn't have a query. This results in the incorrect caching of queryParameterString.

The fix is to ensure queryParameterString is initialized to an empty string when the current session's URI does not contain a query component.

The bug is reproduced with nanohttpd + okhttp which is also used to validate the fix.

…ery.

In HTTP 1.1, connection is reused across HTTP connection (aka HTTP session in nanohttpd). See the connection reuse codes in ClientHandler where HTTPSession is reused by calling execute() in a while loop.

However, in HTTPSession, queryParameterString is not cleaned up correctly across sessions when a previous session has a query while the current one doesn't have a query. This results in the incorrect caching of queryParameterString. 

The fix is to ensure queryParameterString is initialized to an empty string when the current session's URI does not contain a query component.

The bug is reproduced with nanohttpd + okhttp which is also used to validate the fix.
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

Successfully merging this pull request may close these issues.

1 participant