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

upgrade httpclient and include http-cookie #121

Closed
wants to merge 3 commits into from

Conversation

hfaulds
Copy link
Contributor

@hfaulds hfaulds commented Jun 5, 2015

We discussed this in #113 and #105

To summarise. At the moment our Rets::HttpClient#http_cookie implementation assumes the httpclient is using WebAgent::CookieManager and WebAgent::Cookie under the hood.

If a project requires httpclient 2.6 and http-cookie then this breaks as httpclient loads HttpClient::CookieManager and a different cookie implementation.

A couple quick fixes would be to:

  • explicitly require 'httpclient/webagent-cookie' in our Rets::HttpClient
  • explicitly depend on http-cookie and change out Rets::HttpClient#http_cookie

Moving away from WebAgent::CookieManager is a step towards being able to store cookies in storage other than the filesystem (#105). It is more up to date with RFC and more flexible as well.

Rets::CookieManager exists to expose jar publicly. I made a PR to httpclient so that in the future we should be able to avoid this: nahi/httpclient#254.

This will also make it easy to provide a custom cookie jar implementation.

load_cookies if @cookies_file
end
end
end
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This whole class is a stop-gap for nahi/httpclient#254.

I was a bit loathe to write our own cookie manager just to inject and expose the cookie jar (I'm a bit confused about what parts of HTTPClient rely on what cookie implementations as it seems like internally it uses WebAgent::Cookie some places).

@hfaulds
Copy link
Contributor Author

hfaulds commented Jun 5, 2015

This needs to also be a new version of the Gem as it changes dependencies.

@hfaulds
Copy link
Contributor Author

hfaulds commented Jun 5, 2015

Did some testing against real rets servers. http-cookie's cookie jar expects the cookie store file to be present and exceptions if a non-existant file is provided. We could handle this either in our code or force people to create the files themselves, I'm open to suggestions.

@hfaulds
Copy link
Contributor Author

hfaulds commented Jun 5, 2015

This also spams log output with Cookie#domain returns dot-less domain name now. Use Cookie#dot_domain if you need "." at the beginning.

httpclient appears to set up both the warn and then also call this internally

@dougcole
Copy link
Contributor

dougcole commented Jun 5, 2015

code looks fine. am I right that this would supersede #113?

As long as you've tested it, I'm game to ship it.

@summera
Copy link
Contributor

summera commented Jun 5, 2015

@hfaulds @dougcole Maybe we can combine efforts on this and #113 by merging our PRs together? I think both have ideas we can combine and we are stepping on each others toes at this point.

I just pushed an update to #113 that cleans up the tests and uses http-cookie as we discussed.

For this, do you think it may be premature to override the cookie manager and expose the cookie jar? I see that this would make sense when #105 develops into something, but does not seem necessary at the moment. Also, may be good to have the dependency on http-cookie be ~> 1.0.0 so we don't have another compatibility issue. Same goes for dependency on httpclient.

@hfaulds
Copy link
Contributor Author

hfaulds commented Jun 9, 2015

Closing in favour of #113. Might end up with some of this logic if we write a custom cookie store but this goes beyond what it was supposed to.

@hfaulds hfaulds closed this Jun 9, 2015
@elstgav elstgav deleted the upgrade-http-client-include-http-cookie branch January 6, 2020 18:23
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.

3 participants