Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-6656

Fabric HTTP Gateway should not add "Transfer-Encoding" header field to Response 204

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • jboss-fuse-6.2.1
    • Fabric8 v1, Gateway
    • None
    • % %

      I have a simple CXF jaxrs service deployed in Fabric container. The jaxrs service returns HTTP code 204 "No Content".

      When invoking on the service directly, I am getting:

      $ curl -v -H "Accept: application/json" -H "Content-Type: application/json" -X POST -d '{"Customer":{"id":113,"name":"Dan"}}' http://0.0.0.0:9080/route/customerservice/customers
      *   Trying 0.0.0.0...
      * Connected to 0.0.0.0 (127.0.0.1) port 9080 (#0)
      > POST /route/customerservice/customers HTTP/1.1
      > Host: 0.0.0.0:9080
      > User-Agent: curl/7.43.0
      > Accept: application/json
      > Content-Type: application/json
      > Content-Length: 36
      > 
      * upload completely sent off: 36 out of 36 bytes
      < HTTP/1.1 204 No Content
      < Content-Length: 0
      < Date: Fri, 10 Mar 2017 13:13:08 GMT
      < Server: Jetty(8.1.17.v20150415)
      < 
      * Connection #0 to host 0.0.0.0 left intact
      

      However, when invoking on the service through Fabric HTTP Gateway, the "Transfer-Encoding" header field was added to the response:

      $ curl -v -H "Accept: application/json" -H "Content-Type: application/json" -X POST -d '{"Customer":{"id":113,"name":"Dan"}}' http://0.0.0.0:9000/route/customerservice/customers
      *   Trying 0.0.0.0...
      * Connected to 0.0.0.0 (127.0.0.1) port 9000 (#0)
      > POST /route/customerservice/customers HTTP/1.1
      > Host: 0.0.0.0:9000
      > User-Agent: curl/7.43.0
      > Accept: application/json
      > Content-Type: application/json
      > Content-Length: 36
      > 
      * upload completely sent off: 36 out of 36 bytes
      < HTTP/1.1 204 No Content
      < Content-Length: 0
      < Date: Fri, 10 Mar 2017 13:13:38 GMT
      < Server: Jetty(8.1.17.v20150415)
      < Transfer-Encoding: chunked
      < 
      * Connection #0 to host 0.0.0.0 left intact
      

      The specification RFC 7230 (https://tools.ietf.org/html/rfc7230) section 3.3.1 clearly stated that the "Transfer-Encoding" header field should not be returned in any response with status 204 (No Content):

      A server MUST NOT send a Transfer-Encoding header field in any
      response with a status code of 1xx (Informational) or 204 (No
      Content). A server MUST NOT send a Transfer-Encoding header field in
      any 2xx (Successful) response to a CONNECT request (Section 4.3.6 of
      [RFC7231]).

      https://tools.ietf.org/html/rfc7230#section-3.3.1

              pantinor@redhat.com Paolo Antinori
              rhn-support-qluo Joe Luo
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: