You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Satoshi Nakamura (JIRA)" <ji...@apache.org> on 2007/04/18 06:36:15 UTC
[jira] Created: (HTTPCLIENT-647) https connection over proxy with
auth fails
https connection over proxy with auth fails
-------------------------------------------
Key: HTTPCLIENT-647
URL: https://issues.apache.org/jira/browse/HTTPCLIENT-647
Project: HttpComponents HttpClient
Issue Type: Bug
Components: HttpClient
Affects Versions: 3.1 RC1, 3.0.1
Environment: java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)
Reporter: Satoshi Nakamura
When I try to connect to a https server using a proxy which requires authentication, httpclient fails. It is because the proxy server close the connection after sending 407 response and httpclient doesn't reopen a connection. The proxy server which I confirm that this issue occurs is delegate 9.5.6.
Here is a patch to fix this issue.
diff -u -r commons-httpclient-3.0.1/src/java/org/apache/commons/httpclient/HttpMethodDirector.java commons-httpclient-3.0.1.new/src/java/org/apache/commons/httpclient/HttpMethodDirector.java
--- commons-httpclient-3.0.1/src/java/org/apache/commons/httpclient/HttpMethodDirector.java 2006-05-07 10:22:22.000000000 +0900
+++ commons-httpclient-3.0.1.new/src/java/org/apache/commons/httpclient/HttpMethodDirector.java 2007-04-17 20:06:11.453125000 +0900
@@ -477,6 +477,9 @@
int code;
for (;;) {
+ if (this.conn.getParams().isStaleCheckingEnabled()) {
+ this.conn.closeIfStale();
+ }
if (!this.conn.isOpen()) {
this.conn.open();
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org
[jira] Commented: (HTTPCLIENT-647) https connection over proxy with
auth fails
Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCLIENT-647?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12489675 ]
Oleg Kalnichevski commented on HTTPCLIENT-647:
----------------------------------------------
> Although it doesn't httpclient's fault, I think it's still good to recover from those illegal conditions using closeIfStale(). How do you feel about it?
Satoshi,
The stale connection check is _very_ expensive in terms of performance (up to 30ms per request) and I do not feel like adding workarounds to the stock version of HttpClient for all sorts of broken proxies out there. HttpClient 4.0 should provide a means to override the default HTTP response interceptors and to inject custom processing logic intended to deal with various protocol violations on a case by case basis.
Oleg
> https connection over proxy with auth fails
> -------------------------------------------
>
> Key: HTTPCLIENT-647
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-647
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: HttpClient
> Affects Versions: 3.0.1, 3.1 RC1
> Environment: java version "1.6.0_01"
> Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
> Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)
> Reporter: Satoshi Nakamura
> Attachments: commons-httpclient.log
>
>
> When I try to connect to a https server using a proxy which requires authentication, httpclient fails. It is because the proxy server close the connection after sending 407 response and httpclient doesn't reopen a connection. The proxy server which I confirm that this issue occurs is delegate 9.5.6.
> Here is a patch to fix this issue.
> diff -u -r commons-httpclient-3.0.1/src/java/org/apache/commons/httpclient/HttpMethodDirector.java commons-httpclient-3.0.1.new/src/java/org/apache/commons/httpclient/HttpMethodDirector.java
> --- commons-httpclient-3.0.1/src/java/org/apache/commons/httpclient/HttpMethodDirector.java 2006-05-07 10:22:22.000000000 +0900
> +++ commons-httpclient-3.0.1.new/src/java/org/apache/commons/httpclient/HttpMethodDirector.java 2007-04-17 20:06:11.453125000 +0900
> @@ -477,6 +477,9 @@
>
> int code;
> for (;;) {
> + if (this.conn.getParams().isStaleCheckingEnabled()) {
> + this.conn.closeIfStale();
> + }
> if (!this.conn.isOpen()) {
> this.conn.open();
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org
[jira] Commented: (HTTPCLIENT-647) https connection over proxy with
auth fails
Posted by "Satoshi Nakamura (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCLIENT-647?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12489643 ]
Satoshi Nakamura commented on HTTPCLIENT-647:
---------------------------------------------
After a server disconnects a connection after sending 407 response, isOpen() continues to return true because it doesn't care the server disconnects. When closeIfStale() is called, it detects that the server disconnected the connection and resets isOpen flag to false. At this time isOpen() returns false so that it tries to reopen a connection again. Without this, it tries to write to the closed connection and throws IOException.
I'll post logs later.
> https connection over proxy with auth fails
> -------------------------------------------
>
> Key: HTTPCLIENT-647
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-647
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: HttpClient
> Affects Versions: 3.0.1, 3.1 RC1
> Environment: java version "1.6.0_01"
> Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
> Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)
> Reporter: Satoshi Nakamura
>
> When I try to connect to a https server using a proxy which requires authentication, httpclient fails. It is because the proxy server close the connection after sending 407 response and httpclient doesn't reopen a connection. The proxy server which I confirm that this issue occurs is delegate 9.5.6.
> Here is a patch to fix this issue.
> diff -u -r commons-httpclient-3.0.1/src/java/org/apache/commons/httpclient/HttpMethodDirector.java commons-httpclient-3.0.1.new/src/java/org/apache/commons/httpclient/HttpMethodDirector.java
> --- commons-httpclient-3.0.1/src/java/org/apache/commons/httpclient/HttpMethodDirector.java 2006-05-07 10:22:22.000000000 +0900
> +++ commons-httpclient-3.0.1.new/src/java/org/apache/commons/httpclient/HttpMethodDirector.java 2007-04-17 20:06:11.453125000 +0900
> @@ -477,6 +477,9 @@
>
> int code;
> for (;;) {
> + if (this.conn.getParams().isStaleCheckingEnabled()) {
> + this.conn.closeIfStale();
> + }
> if (!this.conn.isOpen()) {
> this.conn.open();
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org
[jira] Commented: (HTTPCLIENT-647) https connection over proxy with
auth fails
Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCLIENT-647?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12489635 ]
Oleg Kalnichevski commented on HTTPCLIENT-647:
----------------------------------------------
Satoshi,
What does stale connection check have to do with the proxy authentication? Could you please provide a complete wire/context log of the HTTP session that exhibits the problem?
http://jakarta.apache.org/commons/httpclient/logging.html
Oleg
> https connection over proxy with auth fails
> -------------------------------------------
>
> Key: HTTPCLIENT-647
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-647
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: HttpClient
> Affects Versions: 3.0.1, 3.1 RC1
> Environment: java version "1.6.0_01"
> Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
> Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)
> Reporter: Satoshi Nakamura
>
> When I try to connect to a https server using a proxy which requires authentication, httpclient fails. It is because the proxy server close the connection after sending 407 response and httpclient doesn't reopen a connection. The proxy server which I confirm that this issue occurs is delegate 9.5.6.
> Here is a patch to fix this issue.
> diff -u -r commons-httpclient-3.0.1/src/java/org/apache/commons/httpclient/HttpMethodDirector.java commons-httpclient-3.0.1.new/src/java/org/apache/commons/httpclient/HttpMethodDirector.java
> --- commons-httpclient-3.0.1/src/java/org/apache/commons/httpclient/HttpMethodDirector.java 2006-05-07 10:22:22.000000000 +0900
> +++ commons-httpclient-3.0.1.new/src/java/org/apache/commons/httpclient/HttpMethodDirector.java 2007-04-17 20:06:11.453125000 +0900
> @@ -477,6 +477,9 @@
>
> int code;
> for (;;) {
> + if (this.conn.getParams().isStaleCheckingEnabled()) {
> + this.conn.closeIfStale();
> + }
> if (!this.conn.isOpen()) {
> this.conn.open();
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org
[jira] Updated: (HTTPCLIENT-647) https connection over proxy with
auth fails
Posted by "Satoshi Nakamura (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCLIENT-647?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Satoshi Nakamura updated HTTPCLIENT-647:
----------------------------------------
Attachment: commons-httpclient.log
Attached please see the log I took. As you mentioned, the server sends "Proxy-Connection: keep-alive" (with parameters) and I've confirmed that if it sent "Proxy-Connection: closed", httpclient would work well.
Although it doesn't httpclient's fault, I think it's still good to recover from those illegal conditions using closeIfStale(). How do you feel about it?
> https connection over proxy with auth fails
> -------------------------------------------
>
> Key: HTTPCLIENT-647
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-647
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: HttpClient
> Affects Versions: 3.0.1, 3.1 RC1
> Environment: java version "1.6.0_01"
> Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
> Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)
> Reporter: Satoshi Nakamura
> Attachments: commons-httpclient.log
>
>
> When I try to connect to a https server using a proxy which requires authentication, httpclient fails. It is because the proxy server close the connection after sending 407 response and httpclient doesn't reopen a connection. The proxy server which I confirm that this issue occurs is delegate 9.5.6.
> Here is a patch to fix this issue.
> diff -u -r commons-httpclient-3.0.1/src/java/org/apache/commons/httpclient/HttpMethodDirector.java commons-httpclient-3.0.1.new/src/java/org/apache/commons/httpclient/HttpMethodDirector.java
> --- commons-httpclient-3.0.1/src/java/org/apache/commons/httpclient/HttpMethodDirector.java 2006-05-07 10:22:22.000000000 +0900
> +++ commons-httpclient-3.0.1.new/src/java/org/apache/commons/httpclient/HttpMethodDirector.java 2007-04-17 20:06:11.453125000 +0900
> @@ -477,6 +477,9 @@
>
> int code;
> for (;;) {
> + if (this.conn.getParams().isStaleCheckingEnabled()) {
> + this.conn.closeIfStale();
> + }
> if (!this.conn.isOpen()) {
> this.conn.open();
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org
[jira] Resolved: (HTTPCLIENT-647) https connection over proxy with
auth fails
Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCLIENT-647?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Oleg Kalnichevski resolved HTTPCLIENT-647.
------------------------------------------
Resolution: Invalid
Exactly as I thought
<< "HTTP/1.1 407 Proxy Authentication Required[\r][\n]"
<< "Date: Wed, 18 Apr 2007 09:11:22 GMT[\r][\n]"
<< "Server: DeleGate/9.5.6[\r][\n]"
<< "DeleGate-Ver: 9.5.6 (delay=0)[\r][\n]"
<< "MIME-Version: 1.0[\r][\n]"
<< "Content-Type: text/html[\r][\n]"
<< "Content-Length: 100[\r][\n]"
<< "Proxy-Connection: keep-alive, timeout=50, maxreq=60[\r][\n]"
<< "Proxy-Authenticate: Basic Realm="proxy"[\r][\n]"
Please consider submitting a bug report to the developers of DeleGate proxy
Oleg
> https connection over proxy with auth fails
> -------------------------------------------
>
> Key: HTTPCLIENT-647
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-647
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: HttpClient
> Affects Versions: 3.0.1, 3.1 RC1
> Environment: java version "1.6.0_01"
> Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
> Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)
> Reporter: Satoshi Nakamura
> Attachments: commons-httpclient.log
>
>
> When I try to connect to a https server using a proxy which requires authentication, httpclient fails. It is because the proxy server close the connection after sending 407 response and httpclient doesn't reopen a connection. The proxy server which I confirm that this issue occurs is delegate 9.5.6.
> Here is a patch to fix this issue.
> diff -u -r commons-httpclient-3.0.1/src/java/org/apache/commons/httpclient/HttpMethodDirector.java commons-httpclient-3.0.1.new/src/java/org/apache/commons/httpclient/HttpMethodDirector.java
> --- commons-httpclient-3.0.1/src/java/org/apache/commons/httpclient/HttpMethodDirector.java 2006-05-07 10:22:22.000000000 +0900
> +++ commons-httpclient-3.0.1.new/src/java/org/apache/commons/httpclient/HttpMethodDirector.java 2007-04-17 20:06:11.453125000 +0900
> @@ -477,6 +477,9 @@
>
> int code;
> for (;;) {
> + if (this.conn.getParams().isStaleCheckingEnabled()) {
> + this.conn.closeIfStale();
> + }
> if (!this.conn.isOpen()) {
> this.conn.open();
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org
[jira] Commented: (HTTPCLIENT-647) https connection over proxy with
auth fails
Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCLIENT-647?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12489648 ]
Oleg Kalnichevski commented on HTTPCLIENT-647:
----------------------------------------------
> After a server disconnects a connection after sending 407 response, isOpen() continues to return true because
> it doesn't care the server disconnects.
If the proxy disconnected _correctly_ the underlying connection would have been kept alive. I suspect the proxy does something utterly silly such as returning 'Connection: keep-alive' header and then simply dropping the connection on unsuspected HttpClient. Please post a wire log to clear this up
Oleg
> https connection over proxy with auth fails
> -------------------------------------------
>
> Key: HTTPCLIENT-647
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-647
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: HttpClient
> Affects Versions: 3.0.1, 3.1 RC1
> Environment: java version "1.6.0_01"
> Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
> Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)
> Reporter: Satoshi Nakamura
>
> When I try to connect to a https server using a proxy which requires authentication, httpclient fails. It is because the proxy server close the connection after sending 407 response and httpclient doesn't reopen a connection. The proxy server which I confirm that this issue occurs is delegate 9.5.6.
> Here is a patch to fix this issue.
> diff -u -r commons-httpclient-3.0.1/src/java/org/apache/commons/httpclient/HttpMethodDirector.java commons-httpclient-3.0.1.new/src/java/org/apache/commons/httpclient/HttpMethodDirector.java
> --- commons-httpclient-3.0.1/src/java/org/apache/commons/httpclient/HttpMethodDirector.java 2006-05-07 10:22:22.000000000 +0900
> +++ commons-httpclient-3.0.1.new/src/java/org/apache/commons/httpclient/HttpMethodDirector.java 2007-04-17 20:06:11.453125000 +0900
> @@ -477,6 +477,9 @@
>
> int code;
> for (;;) {
> + if (this.conn.getParams().isStaleCheckingEnabled()) {
> + this.conn.closeIfStale();
> + }
> if (!this.conn.isOpen()) {
> this.conn.open();
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org
[jira] Commented: (HTTPCLIENT-647) https connection over proxy with
auth fails
Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCLIENT-647?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12489649 ]
Oleg Kalnichevski commented on HTTPCLIENT-647:
----------------------------------------------
Damn it. I meant to say "... the underlying connection would NOT have been kept alive...".
> https connection over proxy with auth fails
> -------------------------------------------
>
> Key: HTTPCLIENT-647
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-647
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: HttpClient
> Affects Versions: 3.0.1, 3.1 RC1
> Environment: java version "1.6.0_01"
> Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
> Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)
> Reporter: Satoshi Nakamura
>
> When I try to connect to a https server using a proxy which requires authentication, httpclient fails. It is because the proxy server close the connection after sending 407 response and httpclient doesn't reopen a connection. The proxy server which I confirm that this issue occurs is delegate 9.5.6.
> Here is a patch to fix this issue.
> diff -u -r commons-httpclient-3.0.1/src/java/org/apache/commons/httpclient/HttpMethodDirector.java commons-httpclient-3.0.1.new/src/java/org/apache/commons/httpclient/HttpMethodDirector.java
> --- commons-httpclient-3.0.1/src/java/org/apache/commons/httpclient/HttpMethodDirector.java 2006-05-07 10:22:22.000000000 +0900
> +++ commons-httpclient-3.0.1.new/src/java/org/apache/commons/httpclient/HttpMethodDirector.java 2007-04-17 20:06:11.453125000 +0900
> @@ -477,6 +477,9 @@
>
> int code;
> for (;;) {
> + if (this.conn.getParams().isStaleCheckingEnabled()) {
> + this.conn.closeIfStale();
> + }
> if (!this.conn.isOpen()) {
> this.conn.open();
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org
[jira] Commented: (HTTPCLIENT-647) https connection over proxy with
auth fails
Posted by "Satoshi Nakamura (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCLIENT-647?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12489688 ]
Satoshi Nakamura commented on HTTPCLIENT-647:
---------------------------------------------
Sounds resonanable. Thank you for taking time to look into this.
> https connection over proxy with auth fails
> -------------------------------------------
>
> Key: HTTPCLIENT-647
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-647
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: HttpClient
> Affects Versions: 3.0.1, 3.1 RC1
> Environment: java version "1.6.0_01"
> Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
> Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)
> Reporter: Satoshi Nakamura
> Attachments: commons-httpclient.log
>
>
> When I try to connect to a https server using a proxy which requires authentication, httpclient fails. It is because the proxy server close the connection after sending 407 response and httpclient doesn't reopen a connection. The proxy server which I confirm that this issue occurs is delegate 9.5.6.
> Here is a patch to fix this issue.
> diff -u -r commons-httpclient-3.0.1/src/java/org/apache/commons/httpclient/HttpMethodDirector.java commons-httpclient-3.0.1.new/src/java/org/apache/commons/httpclient/HttpMethodDirector.java
> --- commons-httpclient-3.0.1/src/java/org/apache/commons/httpclient/HttpMethodDirector.java 2006-05-07 10:22:22.000000000 +0900
> +++ commons-httpclient-3.0.1.new/src/java/org/apache/commons/httpclient/HttpMethodDirector.java 2007-04-17 20:06:11.453125000 +0900
> @@ -477,6 +477,9 @@
>
> int code;
> for (;;) {
> + if (this.conn.getParams().isStaleCheckingEnabled()) {
> + this.conn.closeIfStale();
> + }
> if (!this.conn.isOpen()) {
> this.conn.open();
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org