-
Notifications
You must be signed in to change notification settings - Fork 150
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
Follow HTTP redirects #67
Comments
I don't think this is HTTPI's responsibility. To help with it, you can use block to access "native" client. In my tests, only with Curb client i could set follow location option. Httpclient does not have a "follow setter". # using version 1.1.1
request = HTTPI::Request.new("http://google.com")
response = HTTPI.get(request, :curb)
puts response.code # => 301
response = HTTPI.get(request, :curb) do |client|
client.follow_location = true
end
puts response.code # => 200 # using version 2.0.0.rc1
request = HTTPI::Request.new("http://google.com")
response = HTTPI.get(request, :curb)
puts response.code # => 301
response = HTTPI.request(:get, request, :curb) do |client|
client.follow_location = true
end
puts response.code # => 200 I started a client that wraps HTTPI and have many features, one of them is follow redirect. You can try http_monkey or another client of course. Hope that helps, Roger Leite |
i'm not sure about whether this should be supported or not. i'd like to be httpi as complete as possible, but since it's possible to manually follow redirects (or directly configure the client), this is not on top of my todo list right now. if anyone has an opinion about this, let me know. |
Study on HTTPI adapters about redirect feature:
My opinion: |
thanks for doing the research @rogerleite. i appreciate it. since this is definitely a problem for savon, |
i actually started doing exactly that a few hours ago, before i came back to respond to this ticket. i think the http response definitely needs a but implementing redirects in a wsdl parser library felt weird. don't know. |
You're right. Doesn't looks difficult to implement after adapter request. Put an |
it definitely comes with a cost to add any feature, but since httpi was build to support savon and it's actually causing problems, it just has to be fixed. thanks. i'll get back to this tomorrow. |
👍 |
Has anyone come up with a solution to this? |
don't think so. feel free to jump in. |
@rogerleite I'm following up on this issue after seeing some activity on savonrb/wasabi#18 -- do you have any strong feelings on this? I see some discussion of implementing this behavior in Wasabi versus implementing it in HTTPI. @rubiii's thoughts re: implementing it in the WSDL parser definitely makes me think twice, although I understand how complicated it is to implement it in HTTPI (because of the adapters... oh no the adapters). Let's make a decision so we can close one of these two issues and try to make some forward progress. You've thought about this a lot, are you comfortable saying this is outside the scope of |
Hi @tjarratt. Thinking more about this, i agree with @rubiii and we should implement this on HTTPI.
I think this is the easiest way. What do you think @tjarratt? |
👍 That sounds like the easiest way forward without bloating the interface too much. |
Is anyone actively working on this? |
@mikeantonelli maybe @tjarratt started something. |
@rogerleite, I made a first pass at it: mikeantonelli/httpi:02c223d, and the integration: mikeantonelli/savon:3295603. Thoughts? |
Looks good! Wouldn't hurt to add a simple integration test in Savon. It's been my experience that these integration points are the most likely to be broken during aggressive refactoring and merging pull requests. |
@tjarratt, I opened #117 here and savonrb/savon#589, which would require minor update once #117 is merged and released. |
…irects Fixes #67 - Follow HTTP redirects.
The HTTPI library should automaticaly follow HTTP redirects (3xx status codes), at least 301 Moved Permanently, 302 Found, 307 Temporary Redirect, and 308 Permanent Redirect.
The text was updated successfully, but these errors were encountered: