unwire / handsoap

Handsoap is a library for creating SOAP clients in Ruby
http://github.com/unwire/handsoap
225 stars 58 forks source link

net http driver raises ArgumentError (HTTP request path is empty) #31

Closed dredozubov closed 11 years ago

dredozubov commented 11 years ago

Basically this fixes the problem with net-http driver and root-level uris like https://example.com. Otherwise it raises error. Also got rid of useless call to private method.

dredozubov commented 11 years ago

I overlooked a whole query params issue, but url.request_uri should address both our concerns.

General case

URI.parse('http://example.com/').request_uri
=> "/"

Root-level uri. It's the main point i was making after all. It's critical in production after the forced move to the net-http driver. Old code returns "" at this point and it will break any Net::HTTP call.

URI.parse('http://example.com').request_uri
=> "/"

Case with request parameters.

URI.parse('http://example.com/?param1=foo&param2=bar').request_uri
=> "/?param1=foo&param2=bar"
troelskn commented 11 years ago

Yes, much simpler code too. I'm not sure why this wasn't just used originally - I'm wondering if there was a reason, but I can't really come to think of anything. I'll merge the change.