Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-8214

CLONE - Content length missing in HTTP header

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • Invalid
    • Transports
    • None
    • Apache Camel

    Description

      We are using org.apache.cxf.jaxrs.client.WebClient in our solution where we send a list of custom headers. 

      All but "Content-Length" are included and sent. We also tried to disable chunking, but it had no effect.

      Issue exist in org.apache.cxf:cxf-rt-rs-client package, both 3.3.4 and 3.3.5 versions. We are using Java 8 mainly. We also tried with Java 13 with no success.

       

      Partial code:

      Map<String, Object> headers;

      ...

      ...

      ...
      Client client = WebClient.client(api);
      if (headers != null)
          headers.forEach(client::header);

       

      We've managed to debug this and found out that all the headers are kept in the "PROTOCOL_HEADERS" map up until the actual request is made. At that point, "Content-Length" is omitted. 

       

      On a side note, body is "null" for the request. Shouldn't the "Content-Length : 0" be automatically added?

      Attachments

        1. Test-Content-Length.zip
          10 kB
          Ivan Topić
        2. Test-Content-Length-Main.zip
          10 kB
          Ivan Topić
        3. FiddlerRequestScreenShot.PNG
          8 kB
          Ivan Topić

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Ivan Topić Ivan Topić
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: