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

SSL detection based on 'https://` protocol not guaranteed to work #420

Closed
oskarbruening opened this issue Mar 27, 2013 · 13 comments
Closed

Comments

@oskarbruening
Copy link

Here's the issue:

  • I have a 3rd party https SOAP server that I need to work with. The url for that server starts with "https", no port provided.
  • I provide the url to savon as per documentation: client = Savon.client(wsdl: 'https://.….')
  • In Savon::Client the URL is passed in to the Wasabi document:
  • @wsdl.document = @globals[:wsdl] if @globals.include? :wsdl
  • In the last line of that method HTTPI does a get to the URL to determine the correct URI.
  • --> the https uri is changed to "http://....:443/..." = the https protocol is stripped and the ssl port 443 is added
  • The problem is that now in HTTPI::Request.ssl? the ssl functionality is determined by !!(url.to_s =~ /^https/)
  • --> this now return false because the URI no longer has the protocol listed
  • --> the request in Savon fails because HTTPI does not use .use_ssl in the net_http request.

Two options, neither of which I'm a big fan, but wanted to get your feedback:

  • Change HTTPI::Request.ssl? to also look for the 443 port
  • Have Savon check the protocol in the original URL and force ssl by setting .ssl = true on the HTTPI request.

The workaround is to use the endpoint global:

client = Savon.client(wsdl: @url, endpoint: @url)

does the job because Savon::Operation.endpoint checks @Globals first to get the url. This is a good work around for us for now, but it's not intuitive and might need to be documented / fixed.

@rubiii
Copy link
Contributor

rubiii commented Mar 29, 2013

hey @oskarbruening, thanks for reporting this. i would need a test to verify the problem, but currently don't have the time to write it. i think this should be fixed though and a failing test would probably make it easier to come up with a proper solution.

@rubiii
Copy link
Contributor

rubiii commented Apr 19, 2013

@oskarbruening could you point me to the code for this?

* In the last line of that method HTTPI does a get to the URL to determine the correct URI.

right now, i don't really understand the problem, so if you can't provide code or a test to reproduce this,
maybe you can try to describe the problem with a little more details.

@unixmonkey
Copy link

I think I'm having the same issue as @oskarbruening , also mentioned by vaibhavbansal in #297

The WSDL server is accessed over HTTPS, but has an untrusted certificate.

I try to connect with client = Savon.client(wsdl: 'https://example.com/foo?wsdl', ssl_verify_mode: :none), but when it goes to hit the server, the server responds with Connection refused - connect(2) (Errno::ECONNREFUSED)

Connecting with client = Savon.client(wsdl: 'https://example.com/foo?wsdl', endpoint: 'https://example.com/foo?wsdl', ssl_verify_mode: :none) works like a charm.

At this line:
https://github.com/savonrb/savon/blob/master/lib/savon/client.rb#L61
@wsdl.endpoint is still null. When @wsdl.request = WSDLRequest.new(@globals).build is called (which does make a request), thereafter @wsdl.endpoint returns a URI that is plain http.

If there's anything I can do to further help debug, please let me know.

@rubiii
Copy link
Contributor

rubiii commented Apr 23, 2013

@unixmonkey savon extracts the endpoint from the wsdl. please check whether that one uses http or https.

@rubiii
Copy link
Contributor

rubiii commented Apr 23, 2013

@unixmonkey can you provide code or a test to verify this problem?

@unixmonkey
Copy link

@rubiii You are completely right. The WSDLs I'm working with specify http:// instead of https:// inside them, even though they are actually only available at the https url.

@oskarbruening I know it's been awhile, but can you check to see if your WSDL has the same issue?

@rubiii
Copy link
Contributor

rubiii commented Apr 25, 2013

@unixmonkey thanks for getting back. so i would consider closing this one unless @oskarbruening actually has a different problem and can provide code or further information to reproduce the problem.

@oskarbruening
Copy link
Author

It's a different issue. Who can I email with more details that I'd prefer not to share publicly here?

@rubiii
Copy link
Contributor

rubiii commented Apr 25, 2013

@oskarbruening you can email me at me@rubiii.com

@mikecmpbll
Copy link

I've just confirmed I'm having the same issue that can be solved by supplying the wsdl URI to the endpoint option too. I don't really understand why though, it may be a problem with the WSDL i'm consuming. I get Errno::ETIMEDOUT: Operation timed out - connect(2) when I do not.

@stale
Copy link

stale bot commented Feb 19, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Feb 19, 2018
@stale
Copy link

stale bot commented Feb 26, 2018

This issue is now closed due to inactivity. If you believe this needs further action, please re-open to discuss.

@stale stale bot closed this as completed Feb 26, 2018
@swistak
Copy link

swistak commented Sep 6, 2018

thanks for the provided workaround!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants