# Net/http post\_form problem

**URL:** <https://www.ruby-forum.com/t/net-http-post-form-problem/169652>\
**Category:** IronRuby\
**Created:** [June 6, 2009, 10:33am UTC](https://www.ruby-forum.com/t/net-http-post-form-problem/169652 "2009-06-06T10:33:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shayfriedman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@shayfriedman](https://www.ruby-forum.com/u/shayfriedman)\
**Post date:** [June 6, 2009, 10:33am UTC](https://www.ruby-forum.com/t/net-http-post-form-problem/169652/1 "2009-06-06T10:33:58Z")

</div>

Hi,

I’m trying to execute the next code:  
require ‘net/http’  
require ‘uri’

puts “starting…”  
url = URI.parse(‘[http://localhost/test3/demo.aspx](http://localhost/test3/demo.aspx)’)

puts “retrieving…”  
res = Net::HTTP.post\_form(url,  
{“FullName” =\> “Shay F.”})

puts “writing”  
File.open(“test.txt”,“w”) { |file| file.print res.body }

It uses the net/http library to send a post request to the given web  
site. The problem is that it gets a timeout every single time on the  
post\_form method.

I have tried to put a breakpoint on the Page\_Load event of the demo.aspx  
code and the breakpoint is never hit!  
I tried this code sample using MRI and it worked great…

Is it a bug?

## Thanks, Shay

[http://www.ironshay.com](http://www.ironshay.com)

The error I receive after waiting for quite a long time:

---

<div class="post-metadata">

**Author:** ![shayfriedman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@shayfriedman](https://www.ruby-forum.com/u/shayfriedman)\
**Post date:** [June 6, 2009, 6:19pm UTC](https://www.ruby-forum.com/t/net-http-post-form-problem/169652/2 "2009-06-06T18:19:05Z")

</div>

It wouldn’t surprise me if there is a bug. If you look at the Mspec  
tags, you’ll see that a lot of the net/http library is critical (meaning  
it hangs or crashes the interpreter). Feel free to file a bug, or take a  
look to start cleaning it up (if the SOAP stuff isn’t already keeping  
you busy ;))

JD

…there is no try

---

<div class="post-metadata">

**Author:** ![shayfriedman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@shayfriedman](https://www.ruby-forum.com/u/shayfriedman)\
**Post date:** [June 8, 2009, 7:38am UTC](https://www.ruby-forum.com/t/net-http-post-form-problem/169652/3 "2009-06-08T07:38:35Z")

</div>

It might be related to the spec that is failing:

library\net\http\http\post\_form\_spec.rb  
critical:Net::HTTP.post\_form when passed URI POSTs the passed form data  
to the given uri

I’ve filed a bug:  
[http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=1529](http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=1529)

Tomas
