rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
* Missing HTTP reason phrase
@ 2010-02-25 16:01 Florian Munz
  2010-02-25 16:35 ` Iñaki Baz Castillo
  0 siblings, 1 reply; 9+ messages in thread
From: Florian Munz @ 2010-02-25 16:01 UTC (permalink / raw)
  To: Rack Development

Hi,

I was debugging a problem that our Rails app wasn't sending the HTTP
reason phrase in the response, which causes problems in a J2ME HTTP
client.

(responding with "HTTP/1.1 200" instead of "HTTP/1.1 200 OK")

I was wondering whose responsibility this is? I tested this with a lot
of web servers and most of them just add the reason phrase if it's
missing. Nginx, which we use, is the only one that doesn't do it.

The HTTP spec states "The reason phrases listed here are only
recommendations -- they MAY be replaced by local equivalents without
affecting the protocol". This currently doesn't seem to be possible
with Rack, since it only passes the integer.

Any thoughts if this something that should be fixed in Rack or in
nginx?


Cheers,
Florian

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Missing HTTP reason phrase
  2010-02-25 16:01 Missing HTTP reason phrase Florian Munz
@ 2010-02-25 16:35 ` Iñaki Baz Castillo
  2010-02-25 17:23   ` Florian Munz
  0 siblings, 1 reply; 9+ messages in thread
From: Iñaki Baz Castillo @ 2010-02-25 16:35 UTC (permalink / raw)
  To: rack-devel

El Jueves, 25 de Febrero de 2010, Florian Munz escribió:
> Hi,
> 
> I was debugging a problem that our Rails app wasn't sending the HTTP
> reason phrase in the response, which causes problems in a J2ME HTTP
> client.
> 
> (responding with "HTTP/1.1 200" instead of "HTTP/1.1 200 OK")
> 
> I was wondering whose responsibility this is? I tested this with a lot
> of web servers and most of them just add the reason phrase if it's
> missing. Nginx, which we use, is the only one that doesn't do it.
> 
> The HTTP spec states "The reason phrases listed here are only
> recommendations -- they MAY be replaced by local equivalents without
> affecting the protocol". This currently doesn't seem to be possible
> with Rack, since it only passes the integer.
> 
> Any thoughts if this something that should be fixed in Rack or in
> nginx?

First of all let's talk about if it's really an issue of Rack/Nginx:

According to HTTP ABNF grammar the reason phrase is not mandatory, but the 
single space separating the status code and the reason phrase (even if empty) 
*is* mandatory.

So the following is an invalid response status line:

  "HTTP/1.0 200"

but the folllowing is *valid*:

  "HTTP/1.0 200 "

So, which is the case of both?

-- 
Iñaki Baz Castillo <ibc@aliax.net>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Missing HTTP reason phrase
  2010-02-25 16:35 ` Iñaki Baz Castillo
@ 2010-02-25 17:23   ` Florian Munz
  2010-02-25 19:14     ` Iñaki Baz Castillo
  0 siblings, 1 reply; 9+ messages in thread
From: Florian Munz @ 2010-02-25 17:23 UTC (permalink / raw)
  To: Rack Development


On Feb 25, 5:35 pm, Iñaki Baz Castillo wrote:
> First of all let's talk about if it's really an issue of Rack/Nginx:

I agree that it's not necessarily an issue with Rack. Most HTTP
clients seems to handle it just fine. But the Passenger guys also
worked around it:

http://code.google.com/p/phusion-passenger/issues/detail?id=278

> So, which is the case of both?

without the space, as far as I can tell (didn't look at it with
Wireshark):

$ curl -I http://www.qype.co.uk/
HTTP/1.1 200
Server: nginx
Date: Thu, 25 Feb 2010 17:22:29 GMT


Cheers,
Florian

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Missing HTTP reason phrase
  2010-02-25 17:23   ` Florian Munz
@ 2010-02-25 19:14     ` Iñaki Baz Castillo
  2010-02-26  0:15       ` Ryan Tomayko
  0 siblings, 1 reply; 9+ messages in thread
From: Iñaki Baz Castillo @ 2010-02-25 19:14 UTC (permalink / raw)
  To: rack-devel

El Jueves, 25 de Febrero de 2010, Florian Munz escribió:
> without the space, as far as I can tell (didn't look at it with
> Wireshark):
> 
> $ curl -I http://www.qype.co.uk/
> HTTP/1.1 200
> Server: nginx
> Date: Thu, 25 Feb 2010 17:22:29 GMT

I've checked it and there is no space after status code (200) so the HTTP 
response is invalid according to HTTP SBNF grammar. 


-- 
Iñaki Baz Castillo <ibc@aliax.net>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Missing HTTP reason phrase
  2010-02-25 19:14     ` Iñaki Baz Castillo
@ 2010-02-26  0:15       ` Ryan Tomayko
  2010-03-01 15:34         ` Florian Munz
  0 siblings, 1 reply; 9+ messages in thread
From: Ryan Tomayko @ 2010-02-26  0:15 UTC (permalink / raw)
  To: rack-devel

On Thu, Feb 25, 2010 at 11:14 AM, Iñaki Baz Castillo <ibc@aliax.net> wrote:
> El Jueves, 25 de Febrero de 2010, Florian Munz escribió:
>> without the space, as far as I can tell (didn't look at it with
>> Wireshark):
>>
>> $ curl -I http://www.qype.co.uk/
>> HTTP/1.1 200
>> Server: nginx
>> Date: Thu, 25 Feb 2010 17:22:29 GMT
>
> I've checked it and there is no space after status code (200) so the HTTP
> response is invalid according to HTTP SBNF grammar.

Each Rack server handler manages writing the HTTP response onto the
wire, so I it's something you'd have to fix in whatever server
implementation you're using. It's possible, but unlikely, that the bad
response writing logic is in the Rack handler.

Thanks,
Ryan

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Missing HTTP reason phrase
  2010-02-26  0:15       ` Ryan Tomayko
@ 2010-03-01 15:34         ` Florian Munz
  2010-03-01 18:03           ` Christian Neukirchen
  0 siblings, 1 reply; 9+ messages in thread
From: Florian Munz @ 2010-03-01 15:34 UTC (permalink / raw)
  To: Rack Development

On Feb 26, 1:15 am, Ryan Tomayko <r...@tomayko.com> wrote:
> Each Rack server handler manages writing the HTTP response onto the
> wire, so I it's something you'd have to fix in whatever server
> implementation you're using. It's possible, but unlikely, that the bad
> response writing logic is in the Rack handler.

Okay, right now every *cgi handler only sends the status code, without
a space and without the reason phrase. That seems to be a bug. If you
agree, I can work on a patch.

The other, more general thing is that it's not possible to have custom
reason phrases with Rack, but I don't really care about that.


Cheers,
Florian

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Missing HTTP reason phrase
  2010-03-01 15:34         ` Florian Munz
@ 2010-03-01 18:03           ` Christian Neukirchen
  2010-03-01 18:10             ` Iñaki Baz Castillo
  0 siblings, 1 reply; 9+ messages in thread
From: Christian Neukirchen @ 2010-03-01 18:03 UTC (permalink / raw)
  To: rack-devel

Florian Munz <florian@qype.com> writes:

> On Feb 26, 1:15 am, Ryan Tomayko <r...@tomayko.com> wrote:
>> Each Rack server handler manages writing the HTTP response onto the
>> wire, so I it's something you'd have to fix in whatever server
>> implementation you're using. It's possible, but unlikely, that the bad
>> response writing logic is in the Rack handler.
>
> Okay, right now every *cgi handler only sends the status code, without
> a space and without the reason phrase. That seems to be a bug. If you
> agree, I can work on a patch.
>
> The other, more general thing is that it's not possible to have custom
> reason phrases with Rack, but I don't really care about that.

["200 Alright, dude", {...}, [...]]

should work by the SPEC, no?

> Cheers,
> Florian
-- 
Christian Neukirchen  <chneukirchen@gmail.com>  http://chneukirchen.org

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Missing HTTP reason phrase
  2010-03-01 18:03           ` Christian Neukirchen
@ 2010-03-01 18:10             ` Iñaki Baz Castillo
  2010-03-01 18:11               ` Magnus Holm
  0 siblings, 1 reply; 9+ messages in thread
From: Iñaki Baz Castillo @ 2010-03-01 18:10 UTC (permalink / raw)
  To: rack-devel

El Lunes, 1 de Marzo de 2010, Christian Neukirchen escribió:
> ["200 Alright, dude", {...}, [...]]
> 
> should work by the SPEC, no?

Mustn't be the first element of the Array a Fixnum?


-- 
Iñaki Baz Castillo <ibc@aliax.net>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Missing HTTP reason phrase
  2010-03-01 18:10             ` Iñaki Baz Castillo
@ 2010-03-01 18:11               ` Magnus Holm
  0 siblings, 0 replies; 9+ messages in thread
From: Magnus Holm @ 2010-03-01 18:11 UTC (permalink / raw)
  To: rack-devel

[-- Attachment #1: Type: text/plain, Size: 468 bytes --]

From the spec: This is an HTTP status. When parsed as integer (to_i), it
must be greater than or equal to 100.

// Magnus Holm


On Mon, Mar 1, 2010 at 19:10, Iñaki Baz Castillo <ibc@aliax.net> wrote:

> El Lunes, 1 de Marzo de 2010, Christian Neukirchen escribió:
> > ["200 Alright, dude", {...}, [...]]
> >
> > should work by the SPEC, no?
>
> Mustn't be the first element of the Array a Fixnum?
>
>
> --
> Iñaki Baz Castillo <ibc@aliax.net>
>

[-- Attachment #2: Type: text/html, Size: 1379 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-03-01 18:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-25 16:01 Missing HTTP reason phrase Florian Munz
2010-02-25 16:35 ` Iñaki Baz Castillo
2010-02-25 17:23   ` Florian Munz
2010-02-25 19:14     ` Iñaki Baz Castillo
2010-02-26  0:15       ` Ryan Tomayko
2010-03-01 15:34         ` Florian Munz
2010-03-01 18:03           ` Christian Neukirchen
2010-03-01 18:10             ` Iñaki Baz Castillo
2010-03-01 18:11               ` Magnus Holm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).