commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient HttpConnection.java
Date Mon, 19 Jul 2004 20:08:06 GMT
olegk       2004/07/19 13:08:06

  Modified:    httpclient/src/java/org/apache/commons/httpclient
                        HttpConnection.java
  Log:
  PR #29897 (questionable default value for BufferedOutputStream size in HttpConnection)
  
  Changelog:
  
  BufferedOutputStream buffer size is 2k max
  
  Contributed by Oleg Kalnichevski
  Reviewed by Michael Becke
  
  Revision  Changes    Path
  1.97      +16 -12    jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnection.java
  
  Index: HttpConnection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnection.java,v
  retrieving revision 1.96
  retrieving revision 1.97
  diff -u -r1.96 -r1.97
  --- HttpConnection.java	5 Jul 2004 22:46:58 -0000	1.96
  +++ HttpConnection.java	19 Jul 2004 20:08:06 -0000	1.97
  @@ -686,10 +686,12 @@
               if (rcvBufSize >= 0) {
                   socket.setReceiveBufferSize(rcvBufSize);
               }        
  -            inputStream = new PushbackInputStream(
  -                socket.getInputStream());
  -            outputStream = new BufferedOutputStream(
  -                socket.getOutputStream(), socket.getSendBufferSize());
  +            int outbuffersize = socket.getSendBufferSize();
  +            if (outbuffersize > 2048) {
  +                outbuffersize = 2048;
  +            }
  +            inputStream = new PushbackInputStream(socket.getInputStream());
  +            outputStream = new BufferedOutputStream(socket.getOutputStream(), outbuffersize);
               isOpen = true;
               used = false;
           } catch (IOException e) {
  @@ -735,10 +737,12 @@
           if (rcvBufSize >= 0) {
               socket.setReceiveBufferSize(rcvBufSize);
           }        
  -        inputStream = new PushbackInputStream(
  -            socket.getInputStream());
  -        outputStream = new BufferedOutputStream(
  -            socket.getOutputStream(), socket.getSendBufferSize());
  +        int outbuffersize = socket.getSendBufferSize();
  +        if (outbuffersize > 2048) {
  +            outbuffersize = 2048;
  +        }
  +        inputStream = new PushbackInputStream(socket.getInputStream());
  +        outputStream = new BufferedOutputStream(socket.getOutputStream(), outbuffersize);
           usingSecureSocket = true;
           tunnelEstablished = true;
           LOG.debug("Secure tunnel created");
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message