Uploaded image for project: 'Immutant'
  1. Immutant
  2. IMMUTANT-630

Web applications can't adequately respond to HEAD requests in certain cases

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Done
    • Affects Version/s: 2.1.6
    • Fix Version/s: 2.1.7
    • Labels:
      None
    • Steps to Reproduce:
      Hide

      Any Ring handler which returns a response without a :body will do (see Description for details).

      Show
      Any Ring handler which returns a response without a :body will do (see Description for details).

      Description

      Web applications currently can't adequately respond to HEAD requests in cases where the actual response body size of a subsequent GET request is indeterminate. Adding a :body of nil to or leaving :body off completely from the response map both result in Immutant adding a Content-Length: 0 header which is in violation of https://tools.ietf.org/html/rfc7230#section-3.3.2 which mandates:

      A server MAY send a Content-Length header field in a response to a
      HEAD request (Section 4.3.2 of [RFC7231]); a server MUST NOT send
      Content-Length in such a response unless its field-value equals the
      decimal number of octets that would have been sent in the payload
      body of a response if the same request had used the GET method.

      Another option I've tried is adding :headers {"content-length" nil} to the response map which again results in Immutant overriding it with Content-Length: 0 in the response.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                dergutemoritz Moritz Heidkamp
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: