# Bug in HTTPClient (shouldn't look for body in 304 response)

**URL:** <https://www.ruby-forum.com/t/bug-in-httpclient-shouldnt-look-for-body-in-304-response/172452>\
**Category:** Ruby\
**Created:** [July 21, 2009, 6:40pm UTC](https://www.ruby-forum.com/t/bug-in-httpclient-shouldnt-look-for-body-in-304-response/172452 "2009-07-21T18:40:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ISSSSaki\_Baz\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/51bf81/32.png) [@ISSSSaki\_Baz\_C](https://www.ruby-forum.com/u/ISSSSaki_Baz_C)\
**Post date:** [July 21, 2009, 6:40pm UTC](https://www.ruby-forum.com/t/bug-in-httpclient-shouldnt-look-for-body-in-304-response/172452/1 "2009-07-21T18:40:01Z")

</div>

Hi, I’ve detected a bug in HTTPClient when receiving a 304 with no  
Content-Length.

According to RFC 2616:

* * *

4.4 Message Length

The transfer-length of a message is the length of the message-body as  
it appears in the message; that is, after any transfer-codings have  
been applied. When a message-body is included with a message, the  
transfer-length of that body is determined by one of the following (in  
order of precedence):

## 1.Any response message which “MUST NOT” include a message-body (such as the 1xx, 204, and 304 responses and any response to a HEAD request) is always terminated by the first empty line after the header fields, regardless of the entity-header fields present in the message

This means that a 304 doesn’t require “Content-Length: 0” at all, and  
HTTPClient shouldn’t wait and look for it. Unfortunatelly HTTPClient  
waits for it and creates ReceiveTimeoutError exception).

I’ve already reported the bug in the project tracker but have received  
no reply at all fro the author (I also wrote him directly with no  
success):

[http://dev.ctor.org/http-access2/ticket/224](http://dev.ctor.org/http-access2/ticket/224)

As you can see in the tracker, I also tryed to fix it but found some  
problems I cannot solve. Anyway I think it’s a easy fix for a more  
experimented programmer 🙂  
could you please help me on fixing it?

Thanks a lot.

---

<div class="post-metadata">

**Author:** ![ISSSSaki\_Baz\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/51bf81/32.png) [@ISSSSaki\_Baz\_C](https://www.ruby-forum.com/u/ISSSSaki_Baz_C)\
**Post date:** [July 22, 2009, 4:15am UTC](https://www.ruby-forum.com/t/bug-in-httpclient-shouldnt-look-for-body-in-304-response/172452/2 "2009-07-22T04:15:14Z")

</div>

On Jul 21, 2009, at 09:36, Iñaki Baz C. wrote:

> Hi, I’ve detected a bug in HTTPClient when receiving a 304 with no  
> Content-Length.

Did you file a bug?

$ gem list -d httpclient

\*\*\* LOCAL GEMS \*\*\*

httpclient (2.1.5.2)  
Author: NAKAMURA, Hiroshi  
Homepage: [http://dev.ctor.org/httpclient](http://dev.ctor.org/httpclient)  
Installed at: /Library/Ruby/Gems/1.8

```
 gives something like the functionality of libwww-perl (LWP) in Ruby

```

It seems the homepage has a bug tracker…

---

<div class="post-metadata">

**Author:** ![ISSSSaki\_Baz\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/51bf81/32.png) [@ISSSSaki\_Baz\_C](https://www.ruby-forum.com/u/ISSSSaki_Baz_C)\
**Post date:** [July 22, 2009, 10:59am UTC](https://www.ruby-forum.com/t/bug-in-httpclient-shouldnt-look-for-body-in-304-response/172452/3 "2009-07-22T10:59:41Z")

</div>

2009/7/22 Eric H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> On Jul 21, 2009, at 09:36, IÃ±aki Baz C. wrote:
> 
> > Hi, I’ve detected a bug in HTTPClient when receiving a 304 with no  
> > Content-Length.
> 
> Did you file a bug?

Yes (as I already told in my mail):

[http://dev.ctor.org/http-access2/ticket/224](http://dev.ctor.org/http-access2/ticket/224)

Unfortunately I get no response for this report.

---

<div class="post-metadata">

**Author:** ![ISSSSaki\_Baz\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/51bf81/32.png) [@ISSSSaki\_Baz\_C](https://www.ruby-forum.com/u/ISSSSaki_Baz_C)\
**Post date:** [July 22, 2009, 11:50am UTC](https://www.ruby-forum.com/t/bug-in-httpclient-shouldnt-look-for-body-in-304-response/172452/4 "2009-07-22T11:50:34Z")

</div>

On Jul 22, 2009, at 01:58 , Iñaki Baz C. wrote:

> [http://dev.ctor.org/http-access2/ticket/224](http://dev.ctor.org/http-access2/ticket/224)
> 
> Unfortunately I get no response for this report.

One thing I can suggest is more code/patch, less English. Sometimes  
the best response you’ll get is status changes on the tickets.  
Sometimes not… really depends on the author, their life, job,  
relationships, phase of moon, etc.
