Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-18589

Bug in org.apache.camel.http.common.DefaultHttpBinding.java

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 3.18.3, 3.20.0
    • camel-http-common
    • None
    • Moderate

    Description

      The readHeaders() method in DefaultHttpBinding class has a bug. The loop "while (names.hasMoreElements()" iterates over all the header names in a http request, and the statement "String value = request.getHeader(name);" ends up reading only one header of the given name. Underlying http request object created by implementations like jetty use Set<String> internally to return unique names for the request.getHeaderNames(), hence if there are multiple headers with same name (e.g. Cookie), then this ends up in creating only a single entry in the exchange headers. I think this can be fixed by calling getHeaders(name) method on the request object rather than the getHeader(name) and then enumerate over the returned values and set a list of headers of the same name.

      Attachments

        1. patchfile.txt
          2 kB
          Praveen Prabhu

        Activity

          People

            davsclaus Claus Ibsen
            prabhupraveen Praveen Prabhu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: