194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
|
# File 'lib/handsoap/http.rb', line 194
def self.send_http_request(request)
self.load!
url = request.url
unless url.kind_of? ::URI::Generic
url = ::URI.parse(url)
end
::URI::Generic.send(:public, :path_query) path = url.path_query
http_request = case request.http_method
when :get
Net::HTTP::Get.new(path)
when :post
Net::HTTP::Post.new(path)
when :put
Net::HTTP::Put.new(path)
when :delete
Net::HTTP::Delete.new(path)
else
raise "Unsupported request method #{request.http_method}"
end
http_client = Net::HTTP.new(url.host, url.port)
http_client.read_timeout = 120
request..each do |k, values|
values.each do |v|
http_request.add_field(k, v)
end
end
http_request.body = request.body
http_response = http_client.start do |client|
client.request(http_request)
end
def http_response.
@header.inject({}) do |h, (k, v)|
h[k.downcase] = v
h
end
end
Handsoap::Http.parse_http_part(http_response., http_response.body, http_response.code)
end
|