From: Lloyd Zusman Date: 2004-11-08T12:16:48+09:00 Subject: Query string ignored in http.post? I'm using Net::HTTP to do a POST operation, but the query string I send with variable settings seems to be ignored. Can anyone tell me what I might be doing wrong? require "net/http" Net::HTTP.version_1_2 Net::HTTP.start('www.myhost.tld', 80) { |http| response = http.post('/test/showvars.php', 'foo=bar&ok=quack') puts response.body() } When I run this, none of the variables show up as having been set. However, if I send these variables to the script via a POST operation by submitting them from a web page inside of a form like the one below, I indeed see them as having been set:
Also, this has nothing to do with the /test/showvars.php script itself, as I see the same results with any and all CGI's and servlets that I invoke via http.post operations. If I use the 1.1 version, I have the same problem with the POST: require "net/http" Net::HTTP.version_1_1 Net::HTTP.start('www.myhost.tld', 80) { |http| response, body = http.post('/test/showvars.php', 'foo=bar&ok=quack') puts body } However, when I run this as a "GET", the variables get set fine: require "net/http" Net::HTTP.start('www.myhost.tld', 80) { |http| response = http.get('/test/showvars.php?foo=bar&ok=quack') puts response.body() } I assume that I must be doing something wrong with the http.post operation, but I can't figure out what that might be, since what I have done seems to follow the Net::HTTP documentation. Any ideas? Oh, I almost forgot this: % ruby --version ruby 1.9.0 (2004-08-03) [i386-freebsd4.0] % uname -sr FreeBSD 4.0-STABLE ... and here's the showvars.php script: Show variables
  
  
Thanks in advance. -- Lloyd Zusman ljz@asfast.com God bless you.