Uploaded image for project: 'HttpComponents HttpClient'
  1. HttpComponents HttpClient
  2. HTTPCLIENT-1956

Using a Proxy with HttpClient overwrite attributes stored under HttpContext for the main request (not proxy one)

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.5.6
    • Fix Version/s: 4.5.7
    • Component/s: HttpClient (classic)
    • Labels:
      None

      Description

      At JMeter, we had this bug report on JMeter 5.0 which uses last GA version of HTTPCORE- 4.4.10/HTTPCLIENT-4.5.6:

      • https://bz.apache.org/bugzilla/show_bug.cgi?id=62852

      • The problem is that below method behaves differently if request is emitted directly or through a Proxy:
      • localContext.getAttribute(HttpCoreContext.HTTP_REQUEST);
        If you run code below and inspect:
      • localContext.getAttribute(HttpCoreContext.HTTP_REQUEST);

      While you  should get this (and you indeed get this if you don't use a proxy):

      • The GET method
      • All headers:
      • X-Sleep:5
      • Host: jmeter.apache.org:443,
      • User-Agent: Apache-HttpClient/4.5.6 (Java/1.8.0_161)
        Instead you get:
      • CONNECT method (the proxy related one)
      • Partial Headers:
      • Host: jmeter.apache.org:443,
      • User-Agent: Apache-HttpClient/4.5.6 (Java/1.8.0_161)
        In test case below:
      • http://localhost:8888 act as proxy (you can use JMeter HTTP Test Script recorder to start a proxy or any proxy implementation running on that port)
      • https://jmeter.apache.org is the target website, but you can use any site you want
      • X-Sleep is the custom header that is lost for example
         

      Find attached JUnit reproducing issue.

      The impact can be wider

        Attachments

        1. ProxyBug.java
          4 kB
          Philippe Mouawad

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                p.mouawad@ubik-ingenierie.com Philippe Mouawad
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m