olegk       2004/08/19 14:39:26

  Modified:    httpclient/src/java/org/apache/commons/httpclient
                        HttpMethodBase.java
  Log:
  Tone down warning messages generated by the readResponseBody method when 
encountering non-fatal protocol violations
  
  Contributed by Oleg Kalnichevski
  
  Revision  Changes    Path
  1.211     +10 -12    
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java
  
  Index: HttpMethodBase.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java,v
  retrieving revision 1.210
  retrieving revision 1.211
  diff -u -r1.210 -r1.211
  --- HttpMethodBase.java       5 Jul 2004 22:46:58 -0000       1.210
  +++ HttpMethodBase.java       19 Aug 2004 21:39:26 -0000      1.211
  @@ -1630,9 +1630,9 @@
       private InputStream readResponseBody(HttpConnection conn)
           throws HttpException, IOException {
   
  -        LOG.trace("enter HttpMethodBase.readResponseBody(HttpState, 
HttpConnection)");
  +        LOG.trace("enter HttpMethodBase.readResponseBody(HttpConnection)");
   
  -        responseBody = null; // is this desired?
  +        responseBody = null;
           InputStream is = conn.getResponseInputStream();
           if (Wire.CONTENT_WIRE.enabled()) {
               is = new WireLogInputStream(is, Wire.CONTENT_WIRE);
  @@ -1666,10 +1666,7 @@
                       }
                   }
               } else {
  -                if (LOG.isWarnEnabled()) {
  -                    LOG.warn("Transfer-Encoding is set but does not contain 
\"chunked\": "
  -                        + transferEncoding);
  -                }
  +                LOG.info("Response content is not chunk-encoded");
                   // The connection must be terminated by closing 
                   // the socket as per RFC 2616, 3.6
                   setConnectionCloseForced(true);
  @@ -1684,8 +1681,9 @@
                       if (connectionHeader != null) {
                           connectionDirective = connectionHeader.getValue();
                       }
  -                    if (!"close".equalsIgnoreCase(connectionDirective)) {
  -                        LOG.warn("Response content length is not known");
  +                    if (this.effectiveVersion.greaterEquals(HttpVersion.HTTP_1_1) 
&& 
  +                        !"close".equalsIgnoreCase(connectionDirective)) {
  +                        LOG.info("Response content length is not known");
                           setConnectionCloseForced(true);
                       }
                       result = is;            
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to