# Net::http breaks post request, Curb (curl) does not

**URL:** <https://www.ruby-forum.com/t/net-http-breaks-post-request-curb-curl-does-not/181927>\
**Category:** Rails\
**Created:** [January 20, 2010, 10:01am UTC](https://www.ruby-forum.com/t/net-http-breaks-post-request-curb-curl-does-not/181927 "2010-01-20T10:01:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![comopasta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/59ef9b/32.png) [@comopasta](https://www.ruby-forum.com/u/comopasta)\
**Post date:** [January 20, 2010, 10:01am UTC](https://www.ruby-forum.com/t/net-http-breaks-post-request-curb-curl-does-not/181927/1 "2010-01-20T10:01:49Z")

</div>

Hi,

I’m having a problem with a simple post request. The issue is that the  
receiving side fails to process the message because apparently the body  
of the post message is not sent in a single packet together with the  
headers. The body contains only xml.

I’m running webrick. The thing is that if I use NET::HTTP the problem  
occurs

h = Net::HTTP::new(‘192.168.xx.xx’, 65654)  
headers = { ‘Content-Type’ =\> ‘application/xml’ }  
@resp = h.request\_post(url, ops, headers)

BUT if I use Curl (via the Curb gem) then there is no problem.  
Everything is sent in one packet and the other side reads the contents  
properly.

* * *

Is there a way to tell net::http to send the request at once??  
I’d like to use that.

I’ll now go through the pain of installing Curb/curl on windows where  
the app runs. So if someone has any hints to get net::http working…

Cheers

---

<div class="post-metadata">

**Author:** ![comopasta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/59ef9b/32.png) [@comopasta](https://www.ruby-forum.com/u/comopasta)\
**Post date:** [January 20, 2010, 10:33am UTC](https://www.ruby-forum.com/t/net-http-breaks-post-request-curb-curl-does-not/181927/2 "2010-01-20T10:33:50Z")

</div>

On Jan 20, 9:01Â am, comopasta Gr [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Is there a way to tell net::http to send the request at once??  
> I’d like to use that.
> 
> I’ll now go through the pain of installing Curb/curl on windows where  
> the app runs. So if someone has any hints to get net::http working…

I don’t know of such an option, I do however know that any server that  
has such a requirement is rather odd and non standards compliant (and  
what are you going to do when you need to send more than one packet of  
data or if a user (for whatever random reason) has a connection with a  
lower packet size than you currently do ?).

Fred

---

<div class="post-metadata">

**Author:** ![comopasta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/59ef9b/32.png) [@comopasta](https://www.ruby-forum.com/u/comopasta)\
**Post date:** [January 20, 2010, 10:50am UTC](https://www.ruby-forum.com/t/net-http-breaks-post-request-curb-curl-does-not/181927/3 "2010-01-20T10:50:46Z")

</div>

Thanks Fred,

Yes you are right the server that is processing the request is not  
really the best. It is for a demo and apparently it behaves that way.

I’m trying to get Curb gem on the windows machine, let see how it goes.  
Using google for that already.

Cheers
