hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r162038 - /jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/DefaultHttpClientConnection.java /jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/DefaultHttpServerConnection.java
Date Wed, 20 Apr 2005 19:17:50 GMT
Author: olegk
Date: Wed Apr 20 12:17:46 2005
New Revision: 162038

URL: http://svn.apache.org/viewcvs?rev=162038&view=rev
Log:
Always use chunk encoding when content length is not known

Modified:
    jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/DefaultHttpClientConnection.java
    jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/DefaultHttpServerConnection.java

Modified: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/DefaultHttpClientConnection.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/DefaultHttpClientConnection.java?rev=162038&r1=162037&r2=162038&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/DefaultHttpClientConnection.java
(original)
+++ jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/DefaultHttpClientConnection.java
Wed Apr 20 12:17:46 2005
@@ -190,12 +190,13 @@
         }
         HttpOutgoingEntity entity = (HttpOutgoingEntity)request.getEntity();
         HttpVersion ver = request.getRequestLine().getHttpVersion();
-        if (entity.isChunked() && ver.lessEquals(HttpVersion.HTTP_1_0)) {
+        boolean chunked = entity.isChunked() || entity.getContentLength() < 0;  
+        if (chunked && ver.lessEquals(HttpVersion.HTTP_1_0)) {
             throw new ProtocolException(
                     "Chunked transfer encoding not allowed for " + ver);
         }
         OutputStream outstream = new HttpDataOutputStream(this.datatransmitter);
-        if (entity.isChunked()) {
+        if (chunked) {
             outstream = new ChunkedOutputStream(outstream);
         }
         entity.writeTo(outstream);

Modified: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/DefaultHttpServerConnection.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/DefaultHttpServerConnection.java?rev=162038&r1=162037&r2=162038&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/DefaultHttpServerConnection.java
(original)
+++ jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/DefaultHttpServerConnection.java
Wed Apr 20 12:17:46 2005
@@ -205,12 +205,13 @@
         }
         HttpOutgoingEntity entity = (HttpOutgoingEntity)response.getEntity();
         HttpVersion ver = response.getStatusLine().getHttpVersion();
-        if (entity.isChunked() && ver.lessEquals(HttpVersion.HTTP_1_0)) {
+        boolean chunked = entity.isChunked() || entity.getContentLength() < 0;  
+        if (chunked && ver.lessEquals(HttpVersion.HTTP_1_0)) {
             throw new ProtocolException(
                     "Chunked transfer encoding not allowed for " + ver);
         }
         OutputStream outstream = new HttpDataOutputStream(this.datatransmitter);
-        if (entity.isChunked()) {
+        if (chunked) {
             outstream = new ChunkedOutputStream(outstream);
         }
         entity.writeTo(outstream);



Mime
View raw message