Basic HTTP Fetcher should always set Content-Length header
----------------------------------------------------------

                 Key: SHINDIG-845
                 URL: https://issues.apache.org/jira/browse/SHINDIG-845
             Project: Shindig
          Issue Type: Bug
          Components: Gadget Rendering Server (Java)
    Affects Versions: trunk, 1.0.x-incubating
            Reporter: Henning Schmiedehausen
         Attachments: SHINDIG-845-trunk.patch

Running the 0.8 compliance test suite showed a consistent failure in test 
MKRT011, which turns out to do a "POST" with empty body to retrieve an XML 
stream. Tracing through the code, it sends out the code using the 
BasicHttpFetcher::fetch() method, which contains

      if (request.getPostBodyLength() > 0) {
        fetcher.setRequestProperty("Content-Length", 
String.valueOf(request.getPostBodyLength()));
        fetcher.setDoOutput(true);
        IOUtils.copy(request.getPostBody(), fetcher.getOutputStream());
      }

due to the fact that the body is empty, this skips setting the Content-Length 
header to 0. The site used in the test suite will return 503 on a POST request 
without a Content-Length header. The attached patches fix this behaviour for 
1.0.x-incubating and trunk.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to