-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Beahivour of HTTPClient.apply if a session already exists #102
Comments
So, I went over this and #9 with @jemc and then did more looking into this and came up with what I think is an acceptable plan for maintaining as much compatability with the existing client as is. Change handler factory creation
While the existing interface is non-surprising if the scheme, post, and port hasn't been seen before, it is very surprising for cases like the code in the body of this issue where the session is shared but, then handlers are expected to be different in some way. This change will make folks write a handler for all requests for a given host using the same handler. Change HTTPClient and associated documentationWe should make it clear that while HTTPClient manages 1 or more connections, it does it with a single handler so if different handling strategies are needed, different HTTPClients should be used. I believe this is the least invasive way to remove this issue and #9. Doing this would then allow for more thorough rethinking of an HTTPClient for Pony. |
The other options for "mostly the same interface" would be: Connection per host/handlerMake the handler part of the session lookup so that we start a new connection for each different handler factory to a given host. This would result in a lot of extra connections if the handler factory is a lambda. This is not a breaking change. Store handler with requestIn _client connection, as part of "sent/unsent", we could store the app handler for a given This is not a breaking change. |
We discussed during sync. We are going to go with #102 (comment) And we are very open to a redesign of the HTTP library to do a new version that has gone through a redesign. |
The handler factory was supplied in the apply method of a client together with the Payload for the request. If the client already had a session for the new host, port and scheme, no new session was created and the supplied handler factory wasn't used. The new design makes it clear, that one client uses the same handler factory for all requests it makes. If different handler factories are needed, different clients need to be created.
The handler factory was supplied in the apply method of a client together with the Payload for the request. If the client already had a session for the new host, port and scheme, no new session was created and the supplied handler factory wasn't used. The new design makes it clear, that one client uses the same handler factory for all requests it makes. If different handler factories are needed, different clients need to be created. Closes ponylang#102 Closes ponylang#9
When calling HTTPClient.apply for the second time using a new HandleFactory, the behaviour isn't quite clear.
I'm trying to work with HTTPClient and promises, but the second promise is not used, only the first one.
As far as I understand from this conversation, this is because a session already exists and the HandlerFactory that is provided in the second call is not used because of that.
The text was updated successfully, but these errors were encountered: