is there a way using Ruby's net/http to post form data to an http proxy?
Posted
by Derek P.
on Stack Overflow
See other posts from Stack Overflow
or by Derek P.
Published on 2010-05-26T01:05:54Z
Indexed on
2010/05/26
1:11 UTC
Read the original article
Hit count: 367
I have a basic Squid server setup and I am trying to use Ruby's Net::HTTP::Proxy class to send a POST of form data to a specified HTTP endpoint.
I assumed I could do the following:
Net::HTTP::Proxy(my_host, my_port).start(url.host) do |h|
req = Net::HTTP::Post.new(url.path)
req.form_data = { "xml" => xml }
h.request(req)
end
But, alas, proxy vs. non-proxied Net::HTTP classes don't seem to use the proxy IP Address. my remote service responds telling me that it received a request from the wrong IP address, ie: not the proxy. I am looking for a specific way to write the procedure, so that I can successfully send a form post via a proxy. Help? :)
© Stack Overflow or respective owner