Uploaded image for project: 'MINA'
  1. MINA
  2. DIRMINA-940

HTTP Client decoder does not support responses without Content-Length header

    Details

      Description

      When an HTTP response is decoded has not Content-Length header, it is rejected by the decoder as it should be accepted according to the spec

        Activity

        Hide
        elecharny Emmanuel Lecharny added a comment -

        Fixed with DIRMINA-920

        Show
        elecharny Emmanuel Lecharny added a comment - Fixed with DIRMINA-920
        Hide
        jeffmaury Jeff MAURY added a comment -

        Fixed by DIRMINA-920

        Show
        jeffmaury Jeff MAURY added a comment - Fixed by DIRMINA-920
        Hide
        elecharny Emmanuel Lecharny added a comment -

        In this case, I do think the response should be decoded following this grammar rules :

        HTTP-message = Simple-Request ; HTTP/0.9 messages

        Simple-Response
        Full-Request ; HTTP/1.0 messages
        Full-Response

        Simple-Response = [ Entity-Body ]

        Entity-Body = *OCTET

        Now, this seems to be an antic 0.9 format. Not sure we want to support that those days...

        Show
        elecharny Emmanuel Lecharny added a comment - In this case, I do think the response should be decoded following this grammar rules : HTTP-message = Simple-Request ; HTTP/0.9 messages Simple-Response Full-Request ; HTTP/1.0 messages Full-Response Simple-Response = [ Entity-Body ] Entity-Body = *OCTET Now, this seems to be an antic 0.9 format. Not sure we want to support that those days...
        Hide
        elecharny Emmanuel Lecharny added a comment -

        From HTTP 1.0 :

        7.2.2 Length
        When an Entity-Body is included with a message, the length of that body may be determined in one of two ways. If a Content-Length header field is present, its value in bytes represents the length of the Entity-Body. Otherwise, the body length is determined by the closing of the connection by the server.

        So we can have a response with no content length. Of course that means the connection has been closed by the server, but this is not a problem for a response.

        FTR, HTTP 1.0 defines nothing like a Keep-Alive directive (except that some servers have implemented it, but the spec is mute about it).

        Show
        elecharny Emmanuel Lecharny added a comment - From HTTP 1.0 : 7.2.2 Length When an Entity-Body is included with a message, the length of that body may be determined in one of two ways. If a Content-Length header field is present, its value in bytes represents the length of the Entity-Body. Otherwise, the body length is determined by the closing of the connection by the server. So we can have a response with no content length. Of course that means the connection has been closed by the server, but this is not a problem for a response. FTR, HTTP 1.0 defines nothing like a Keep-Alive directive (except that some servers have implemented it, but the spec is mute about it).
        Hide
        vrm Julien Vermillard added a comment -

        if you have no content-length, nor chunked encoding, the end of content should be the close of the TCP connection.
        Of course this is not compatible with HTTP1.1/1.0 connection "keep-alive" features.

        I think I seen that somewhere in the RFC

        Show
        vrm Julien Vermillard added a comment - if you have no content-length, nor chunked encoding, the end of content should be the close of the TCP connection. Of course this is not compatible with HTTP1.1/1.0 connection "keep-alive" features. I think I seen that somewhere in the RFC
        Hide
        jeffmaury Jeff MAURY added a comment -

        No, there is no content at all.

        Here is the dump of the response message:

        HTTP RESPONSE STATUS: SUCCESS_RESET_CONTENT
        VERSION: HTTP/1.0
        — HEADER —
        server:Virtel/4.49

        Show
        jeffmaury Jeff MAURY added a comment - No, there is no content at all. Here is the dump of the response message: HTTP RESPONSE STATUS: SUCCESS_RESET_CONTENT VERSION: HTTP/1.0 — HEADER — server:Virtel/4.49
        Hide
        rno Arnaud Bourrée added a comment -

        Do you have "Transfer-Encoding: chunked" header? That should work if it's there

        Could you share sample with headers?

        Regards,

        Arnaud.

        Show
        rno Arnaud Bourrée added a comment - Do you have "Transfer-Encoding: chunked" header? That should work if it's there Could you share sample with headers? Regards, Arnaud.

          People

          • Assignee:
            Unassigned
            Reporter:
            jeffmaury Jeff MAURY
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development