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

No Content-Length or Content-Encoding headers for any http response

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 5.0
    • None
    • HttpClient (classic)
    • None
    • Important

    Description

      HttpClient doesn't show to me the Content-Length or Content-Encoding headers of the response, even thought the server is responding with them, for example this code

       

      CloseableHttpClient httpclient = HttpClients.createDefault();
      HttpGet request = new HttpGet(new URI("https://www.example.com")); 
      CloseableHttpResponse response = httpclient.execute(request);
      Header[] responseHeaders = response.getHeaders();
      for(Header header: responseHeaders) {
          System.out.println(header.getName());
      }
      

       

      prints all the returned headers except the Content-Length or Content-Encoding headers

      Check these questions on stackoverflow.com

      https://stackoverflow.com/questions/61005981/apache-httpclient-is-not-showing-content-length-and-content-encoding-headers-of

       

      https://stackoverflow.com/questions/18726892/apache-httpclient-response-content-length-returns-1

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            Muhammad Reda Muhammad Reda
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: