Minero Aoki <aamine / mx.edit.ne.jp> writes:

>   In mail "[ruby-talk:29227] HTTP POST"
>     Jim Menard <jimm / io.com> wrote:
> 
> > I'm having a problem with HTTP POST under Ruby 1.6.4 and 1.6.5.
> > The code
> 
> > always prints an empty body. The response['content-type'] is what I expect
> > ("text/html"). However, GET works. When I execute the following code, I see
> > the expected response body text.
> 
> > I know that the Net::HTTP module is under transition. Is this expected
> > behavior?
> 
> No. There's something wrong.
> Please execute the code below and tell me results.
> 
>     data = "hello=world"
>     Net::HTTP.start(HOST, PORT) {|http|
>         response = http.post2(PATH, data)
> 	p response.code
> 	p response.code_type.body_exist?
> 	p response['Content-Length']
> 	p response['Transfer-Encoding']
>         p response.body
>     }

Thank you for responding. Here are the results:

"200"
true
nil
"chunked"
""
And just in case this helps, I added

    response.each { | key, val |
	puts "#{key} => #{val}"
    }

and the output of that was

date => Sat, 22 Dec 2001 02:58:18 GMT
set-cookie2 => JSESSIONID=qqh9i02sl1;Version=1;Discard;Path="/PingServer"
content-type => text/xml
set-cookie => JSESSIONID=qqh9i02sl1;Path=/PingServer
servlet-engine => Tomcat Web Server/3.2.3 (JSP 1.1; Servlet 2.2; Java 1.3.1-internal; FreeBSD 4.4-STABLE i386; java.vendor=Sun Microsystems Inc.)
server => Apache/1.3.22 (Unix) mod_jk mod_ssl/2.8.5 OpenSSL/0.9.6a PHP/4.0.6
transfer-encoding => chunked

I even wrote code that intercepted the read_chunked method to make sure
that the chunked data was being read (that is, the method
Net::HTTP::read_chunked was being called). It was.

Jim
-- 
Jim Menard, jimm / io.com, http://www.io.com/~jimm/
"Abraham Lincoln didn't die in vain. He died in Washington, D.C."
    -- Firesign Theatre