#89 ✓invalid
Paul Sadauskas (Rando)

Date header missing

Reported by Paul Sadauskas (Rando) | November 25th, 2008 @ 02:01 PM | in Future

Thin (1.0) does not set the date header. According to the HTTP 1.1 spec:

Origin servers MUST include a Date header field in all responses, except in these cases:

     1. If the response status code is 100 (Continue) or 101 (Switching
        Protocols), the response MAY include a Date header field, at
        the server's option.

     2. If the response status code conveys a server error, e.g. 500
        (Internal Server Error) or 503 (Service Unavailable), and it is
        inconvenient or impossible to generate a valid Date.

     3. If the server does not have a clock that can provide a
        reasonable approximation of the current time, its responses
        MUST NOT include a Date header field. In this case, the rules
        in section 14.18.1 MUST be followed.

Current output:

HTTP/1.1 200 OK
Content-Type: application/vnd.absperf.sscj1+json; charset=utf-8
Connection: close
Server: thin 1.0.0 codename That's What She Said

I understand that in most cases, thin will be proxied behind another web server, and you may wish to avoid it for performance reasons (Time.now.rfc_2822.to_s is rather slow) but I thought it important that you at least be aware.

Comments and changes to this ticket

  • macournoyer

    macournoyer November 25th, 2008 @ 02:11 PM

    • State changed from “new” to “invalid”

    Thx for pointing this out Paul. But like you mentioned, Thin is to be used being a proxy server which should take care of this.

    If it's important for you that Thin sets the Date header you can build a simple Rack middleware to do so.

    class DateHeader
      def initialize(app)
        @app = app
      def call(env)
        status, headers, body = @app.call(env)
        headers["Date"] = Time.now.rfc_2822.to_s
        status, headers, body

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

People watching this ticket