Subject: Status Line Syntax production/parsing

From: Karl Dubost <[email-masked]>
Date: Tue, 28 Aug 2012 14:29:15 -0400

Hi,

(a naive question)
The syntax for the status-line of an HTTP response message is

    status-line = HTTP-version SP status-code SP reason-phrase CRLF
    — http://tools.ietf.org/html/draft-ietf-httpbis-p1-messaging-20#section-3.1.2

Then about the reason-phrase

   The reason-phrase element exists for the sole purpose of providing a
   textual description associated with the numeric status code, mostly
   out of deference to earlier Internet application protocols that were
   more frequently used with interactive text clients.  A client SHOULD
   ignore the reason-phrase content.

     reason-phrase  = *( HTAB / SP / VCHAR / obs-text )

I was wondering if there are any issues with status-line of the form:

    status-line = HTTP-version SP status-code SP

OR

    status-line = HTTP-version SP status-code

-- 
Karl Dubost - http://dev.opera.com/
Developer Relations, Opera Software

---

From: Bjoern Hoehrmann <[email-masked]>
Date: Tue, 28 Aug 2012 20:47:29 +0200

>    — http://tools.ietf.org/html/draft-ietf-httpbis-p1-messaging-20#section-3.1.2

So there have to be two spaces, one before status-code and one after.

>     reason-phrase  = *( HTAB / SP / VCHAR / obs-text )

So a reason-phrase can be the empty string.

>    status-line = HTTP-version SP status-code SP

It seems you are asking about, say,

  HTTP/1.1<sp>200<sp><crlf>

Which has the empty string as reason-phrase. That is fine.

>    status-line = HTTP-version SP status-code

If you are asking about something like

  HTTP/1.1<sp>200<crlf>

Without the <sp> after the status code, then no, that is not fine.
-- 
Björn Höhrmann · mailto:[email-masked] · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/

---

From: Karl Dubost <[email-masked]>
Date: Tue, 28 Aug 2012 15:09:53 -0400

Bjoern,

> Without the <sp> after the status code, then no, that is not fine.

Yes, that was my reading too. Thanks for confirming.
I was wondering if it was intentional, because a meaningful trailing space is likely to create interoperability issues. Though I have nothing to backup that. It might not be a concern at all.

Basically I would have proposed something such as

    status-line = HTTP-version SP status-code (CRLF|SP reason-phrase CRLF) 

so handling the case with no trailing space.

---

From: Julian Reschke <[email-masked]>
Date: Tue, 28 Aug 2012 21:46:34 +0200

> so handling the case with no trailing space.

Well,

	HTTP-version SP status-code [ SP reason-phrase ] CRLF

On the other hand, a ultra-simple syntax for the first line might sense; 
and there may be code out there relying on it.

Best regards, Julian

---

From: Zhong Yu <[email-masked]>
Date: Tue, 28 Aug 2012 15:02:10 -0500

It's too late to change the syntax now. For interoperability it's
better to not produce any empty reason phrase. A status line

    HTTP/1.1 200

probably looks suspicious to most people.

---

From: Mark Nottingham <[email-masked]>
Date: Wed, 29 Aug 2012 10:59:00 +1000

On 29/08/2012, at 5:46 AM, Julian Reschke <[email-masked]> wrote:
> On the other hand, a ultra-simple syntax for the first line might sense; and there may be code out there relying on it.

Yes, that's the thing. If we were designing this from scratch, that'd make sense; however, we're not, and I'd say it's very likely some implementations depend upon this.

Cheers,

--
Mark Nottingham
http://www.mnot.net/