Hello Alexander,

I agree that my implementation about "Connection: Keep-Alive" is incorrect. Thank you.

And as mentioned in the spec of "Persistent Connections"[1]:

.....

/The support for HTTP keep-Alive is done transparently. However, it can be controlled by system properties http.keepAlive, and http.maxConnections, as well as by HTTP/1.1 specified request and response headers.

The system properties that control the behavior of Keep-Alive are:

http.keepAlive=<boolean>
default: true
Indicates if keep alive (persistent) connections should be supported.

http.maxConnections=<int>
default: 5
Indicates the maximum number of connections per destination to be kept alive at any given time/
.....

So we SHALL provide some kind of cache mechanism to support Persistent Connections, would you mind raise a separate JIRA about this issue? Thanks a lot.


1.http://java.sun.com/j2se/1.5.0/docs/guide/net/http-keepalive.html

Alexander Kleymenov (JIRA) wrote:
[ http://issues.apache.org/jira/browse/HARMONY-499?page=comments#action_12414202 ]
Alexander Kleymenov commented on HARMONY-499:
---------------------------------------------

Hello,

I am working on HttpsURLConnection and noticed this JIRA report.

I went through the Java 5 Enhancements for Networking and could not found any statements for HttpURLConnection. Then I examined the HTTP protocol specification (RFC 2616 can be found at http://www.ietf.org/rfc/rfc2616.txt).
It says:
   "HTTP/1.1 applications that do not support persistent connections MUST
   include the "close" connection option in every message."
The source file of HttpURLConnection implementation does not seem to support persistent connections. So recent changes made to the class

org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection

("Connection: close" --> "Connection: Keep-Alive") seem to be incorrect without 
implementation of support for persistent connections.

Thanks,
Alexander

Java 5 Enhancement: java.net.HttpURLConnection should send request head with a 
connection-field of "Keep-Alive"
---------------------------------------------------------------------------------------------------------------

         Key: HARMONY-499
         URL: http://issues.apache.org/jira/browse/HARMONY-499
     Project: Harmony
        Type: Improvement

  Components: Classlib
    Reporter: Richard Liang
    Assignee: Tim Ellison
    Priority: Minor
 Attachments: luni.src.net.diff

Hello,
java.net.HttpURLConnection should send request head with a default connection-field of 
"Keep-Alive". Currently in its implementation, it sends a connection-field of 
"close", but does not close its own socket after connection, which may cause low 
performance and strange behavior on some servers.
Best regards,
Richard


--
Richard Liang
China Software Development Lab, IBM

Reply via email to