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.
Alexander,
Let Richard speak for himself, but I agree with you that we should
provide the support for persistent connections, as the spec hints:
" Each HttpURLConnection instance is used to make a single request but
the underlying network connection to the HTTP server may be
transparently shared by other instances. Calling the close() methods on
the InputStream or OutputStream of an HttpURLConnection after a request
may free network resources associated with this instance but has no
effect on any shared persistent connection. Calling the disconnect()
method may close the underlying socket if a persistent connection is
otherwise idle at that time."
My idea is some internal socket pool should be maintained, and this
mechanism should can be shared between HttpURLConnection and
HttpsURLConnection, do you have any suggestions on this issue?
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
--
Paulex Yang
China Software Development Lab
IBM
---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]