1

Using curb to communicate with some HTTP server and looks like that HTTP server does not implements Keep-Alive properly.

This is why I'm searching way to force curb not use this feature.

Sure, I can sleep minute or so before making next request, but I'd like to do this in other way.

taro
  • 5,772
  • 2
  • 30
  • 34

1 Answers1

1

By default, curb uses HTTP 1.1, which gives you keep-alive:

?> easy = Curl::Easy.http_get('http://www.yahoo.com')
=> #<Curl::Easy [...]> 
?> easy.header_str.grep(/keep-alive/)
=> ["Connection: keep-alive\r\n"]

To prevent keep-alive, force curb to use HTTP 1.0:

?> easy = Curl::Easy.http_get('http://www.yahoo.com') { |x| x.version = Curl::HTTP_1_0 }
=> #<Curl::Easy [...]> 
?> easy.header_str.grep(/keep-alive/)
=> []
Seamus Abshere
  • 8,326
  • 4
  • 44
  • 61