From: Klesh Date: 2008-10-17T12:26:42+09:00 Subject: [ruby-core:19363] Re: Net::HTTP.post_form bug : can't post form to correct uri which contains QueryString(QueryString part are lost) and revise Dear Matt Thanks for your focus. I have years web programming experience, all the server side programming languages like ASP/PHP/.NET/JSP/RoR i know are all support Query in a POST action. posting form to some url with Query is comprehensive. espeically in some Third Party Web API, in that case, those apps are out of your control. 2008/10/17 Matt Todd : > You are trying to use GET-style query params instead of POSTing the > data as intended. > > You could just as well use the following code: > > Net::HTTP.post_form("http://localhost/api.asp", "Action" => "Check") > > This is the intended use. > > As far as supporting query params for POST actions, doing a quick scan > through applicable RFCs didn't appear to mention whether it was > expressly recommended or not recommended and this may well be a bug. > > However, it is recommended to pass params in the params hash for form > posts as the method is designed. > > Whether the method is correct or not is a good question, though this > should at least get you going. Perhaps the developer had an opinion > and implemented it that way. That's not altogether unrealistic. > > Matt > > > > > > On Thu, Oct 16, 2008 at 10:16 AM, Klesh wrote: >> Hi, >> >> When I tried to do post_form to some url like >> "http://localhost/api.asp?Action=Check", the api.asp can never >> received Query part "Check", so I check out code of post_form method. >> found the following code was totally ignore query part: >> >> def HTTP.post_form(url, params) >> req = Post.new(url.path) >> req.form_data = params >> req.basic_auth url.user, url.password if url.user >> new(url.host, url.port).start {|http| >> http.request(req) >> } >> end >> >> this problem was fixed by changing >> >> req = Post.new(url.path) >> >> to >> req = Post.new(url.request_uri) >> >> Best Regards >> >> Klesh Wong >> >> > >