You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Ben Poweski <bp...@gmail.com> on 2004/10/30 07:16:55 UTC

Invalid HTTP Response

Help!  I'm having some issues with using httpclient with self signed certs.

This current error message is with 3.0alpha2, the same thing happens
in 2.0.2 stable.  The messages are less verbose in the older version.

My connection gets reset when I send an otherwise valid message to the
server.  This exact message does work against a different machine.


This is the trace log:


2004/10/30 00:10:06:487 CDT [DEBUG] HttpClient - Java version: 1.4.2_05
2004/10/30 00:10:06:497 CDT [DEBUG] HttpClient - Java vendor: Sun
Microsystems Inc.
2004/10/30 00:10:06:497 CDT [DEBUG] HttpClient - Java class path:
/c:/Program Files/eclipse/plugins/org.eclipse.jdt.junit_3.0.0/junitsupport.jar;/c:/Program
Files/eclipse/plugins/org.eclipse.jdt.junit.runtime_3.0.0/junitruntime.jar;C:\sowd\blackcomb\bin;C:\Program
Files\eclipse\plugins\org.junit_3.8.1\junit.jar;C:\sowd\blackcomb\lib\commons-logging.jar;C:\sowd\blackcomb\lib\commons-logging-api.jar;C:\sowd\blackcomb\lib\commons-httpclient-3.0-alpha2.jar;C:\sowd\blackcomb\lib\commons-codec-1.3.jar
2004/10/30 00:10:06:557 CDT [DEBUG] HttpClient - Operating system
name: Windows XP
2004/10/30 00:10:06:557 CDT [DEBUG] HttpClient - Operating system
architecture: x86
2004/10/30 00:10:06:557 CDT [DEBUG] HttpClient - Operating system version: 5.1
2004/10/30 00:10:06:767 CDT [DEBUG] HttpClient - SUN 1.42: SUN (DSA
key/parameter generation; DSA signing; SHA-1, MD5 digests;
SecureRandom; X.509 certificates; JKS keystore; PKIX
CertPathValidator; PKIX CertPathBuilder; LDAP, Collection CertStores)
2004/10/30 00:10:06:767 CDT [DEBUG] HttpClient - SunJSSE 1.42: Sun
JSSE provider(implements RSA Signatures, PKCS12, SunX509 key/trust
factories, SSLv3, TLSv1)
2004/10/30 00:10:06:767 CDT [DEBUG] HttpClient - SunRsaSign 1.42:
SUN's provider for RSA signatures
2004/10/30 00:10:06:767 CDT [DEBUG] HttpClient - SunJCE 1.42: SunJCE
Provider (implements DES, Triple DES, AES, Blowfish, PBE,
Diffie-Hellman, HMAC-MD5, HMAC-SHA1)
2004/10/30 00:10:06:777 CDT [DEBUG] HttpClient - SunJGSS 1.0: Sun (Kerberos v5)
2004/10/30 00:10:06:787 CDT [DEBUG] DefaultHttpParams - Set parameter
http.useragent = Jakarta Commons-HttpClient/3.0-alpha2
2004/10/30 00:10:06:787 CDT [DEBUG] DefaultHttpParams - Set parameter
http.protocol.version = HTTP/1.1
2004/10/30 00:10:06:797 CDT [DEBUG] DefaultHttpParams - Set parameter
http.connection-manager.class = class
org.apache.commons.httpclient.SimpleHttpConnectionManager
2004/10/30 00:10:06:797 CDT [DEBUG] DefaultHttpParams - Set parameter
http.protocol.cookie-policy = rfc2109
2004/10/30 00:10:06:797 CDT [DEBUG] DefaultHttpParams - Set parameter
http.protocol.element-charset = US-ASCII
2004/10/30 00:10:06:797 CDT [DEBUG] DefaultHttpParams - Set parameter
http.protocol.content-charset = ISO-8859-1
2004/10/30 00:10:06:837 CDT [DEBUG] DefaultHttpParams - Set parameter
http.method.retry-handler =
org.apache.commons.httpclient.DefaultHttpMethodRetryHandler@5e55ab
2004/10/30 00:10:06:837 CDT [DEBUG] DefaultHttpParams - Set parameter
http.dateparser.patterns = [EEE, dd MMM yyyy HH:mm:ss zzz, EEEE,
dd-MMM-yy HH:mm:ss zzz, EEE MMM d HH:mm:ss yyyy, EEE, dd-MMM-yyyy
HH:mm:ss z, EEE, dd-MMM-yyyy HH-mm-ss z, EEE, dd MMM yy HH:mm:ss z,
EEE dd-MMM-yyyy HH:mm:ss z, EEE dd MMM yyyy HH:mm:ss z, EEE
dd-MMM-yyyy HH-mm-ss z, EEE dd-MMM-yy HH:mm:ss z, EEE dd MMM yy
HH:mm:ss z, EEE,dd-MMM-yy HH:mm:ss z, EEE,dd-MMM-yyyy HH:mm:ss z, EEE,
dd-MM-yyyy HH:mm:ss z]
2004/10/30 00:10:10:623 CDT [DEBUG] header - >> "POST / HTTP/1.1[\r][\n]"
2004/10/30 00:10:10:623 CDT [DEBUG] HttpMethodBase - Adding Host request header
2004/10/30 00:10:10:673 CDT [DEBUG] header - >> "Content-Type:
x-Visa-II/x-auth[\r][\n]"
2004/10/30 00:10:10:673 CDT [DEBUG] header - >> "User-Agent: Jakarta
Commons-HttpClient/3.0-alpha2[\r][\n]"
2004/10/30 00:10:10:673 CDT [DEBUG] header - >> "Host:
ssltest.tnsi.com:5004[\r][\n]"
2004/10/30 00:10:10:673 CDT [DEBUG] header - >> "Content-Length: 104[\r][\n]"
2004/10/30 00:10:11:003 CDT [DEBUG] header - >> "[\r][\n]"
2004/10/30 00:10:11:003 CDT [DEBUG] EntityEnclosingMethod - Request body sent
2004/10/30 00:10:11:294 CDT [DEBUG] header - << "[0x5][\r][\n]"
2004/10/30 00:10:11:304 CDT [DEBUG] header - << "null[\r][\n]"
2004/10/30 00:10:11:304 CDT [DEBUG] HttpMethodDirector - Closing the connection.
2004/10/30 00:10:11:304 CDT [DEBUG] HttpConnection - Releasing
connection back to connection manager.


This is the stack trace:

org.apache.commons.httpclient.ProtocolException: The server
ssltest.tnsi.com failed to respond with a valid HTTP response
	at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1850)
	at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1599)
	at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1010)
	at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:392)
	at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:178)
	at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:437)
	at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)
	at com.ta.vital.net.TestConnection.testConnect(TestConnection.java:65)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at junit.framework.TestCase.runTest(TestCase.java:154)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:118)
	at junit.framework.TestSuite.runTest(TestSuite.java:208)
	at junit.framework.TestSuite.run(TestSuite.java:203)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)



Things i've already done and tried:

I've imported the certificate from the test server into my cacerts keystore.

Does anyone have any idea why i'm getting connection reset?  Could it
possibly be a byte order issue?

I've been running around in circles on this, so any help or comments
would be greatly appreciated!

Thanks in advance.

-Ben

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


Re: Invalid HTTP Response

Posted by Michael Becke <be...@u.washington.edu>.
Hi Ben,

I'm not sure it's an SSL cert issue.  At least not from the error
message.  It seems that the server is just rejecting the request for
some reason.  If possible I would suggest trying the request with SSL
turned off to see if that works.

Mike

On Oct 30, 2004, at 1:16 AM, Ben Poweski wrote:

> Help!  I'm having some issues with using httpclient with self signed  
> certs.
>
> This current error message is with 3.0alpha2, the same thing happens
> in 2.0.2 stable.  The messages are less verbose in the older version.
>
> My connection gets reset when I send an otherwise valid message to the
> server.  This exact message does work against a different machine.
>
>
> This is the trace log:
>
>
> 2004/10/30 00:10:06:487 CDT [DEBUG] HttpClient - Java version: 1.4.2_05
> 2004/10/30 00:10:06:497 CDT [DEBUG] HttpClient - Java vendor: Sun
> Microsystems Inc.
> 2004/10/30 00:10:06:497 CDT [DEBUG] HttpClient - Java class path:
> /c:/Program  
> Files/eclipse/plugins/org.eclipse.jdt.junit_3.0.0/junitsupport.jar;/c: 
> /Program
> Files/eclipse/plugins/org.eclipse.jdt.junit.runtime_3.0.0/ 
> junitruntime.jar;C:\sowd\blackcomb\bin;C:\Program
> Files\eclipse\plugins\org.junit_3.8.1\junit.jar;C: 
> \sowd\blackcomb\lib\commons-logging.jar;C:\sowd\blackcomb\lib\commons- 
> logging-api.jar;C:\sowd\blackcomb\lib\commons-httpclient-3.0- 
> alpha2.jar;C:\sowd\blackcomb\lib\commons-codec-1.3.jar
> 2004/10/30 00:10:06:557 CDT [DEBUG] HttpClient - Operating system
> name: Windows XP
> 2004/10/30 00:10:06:557 CDT [DEBUG] HttpClient - Operating system
> architecture: x86
> 2004/10/30 00:10:06:557 CDT [DEBUG] HttpClient - Operating system  
> version: 5.1
> 2004/10/30 00:10:06:767 CDT [DEBUG] HttpClient - SUN 1.42: SUN (DSA
> key/parameter generation; DSA signing; SHA-1, MD5 digests;
> SecureRandom; X.509 certificates; JKS keystore; PKIX
> CertPathValidator; PKIX CertPathBuilder; LDAP, Collection CertStores)
> 2004/10/30 00:10:06:767 CDT [DEBUG] HttpClient - SunJSSE 1.42: Sun
> JSSE provider(implements RSA Signatures, PKCS12, SunX509 key/trust
> factories, SSLv3, TLSv1)
> 2004/10/30 00:10:06:767 CDT [DEBUG] HttpClient - SunRsaSign 1.42:
> SUN's provider for RSA signatures
> 2004/10/30 00:10:06:767 CDT [DEBUG] HttpClient - SunJCE 1.42: SunJCE
> Provider (implements DES, Triple DES, AES, Blowfish, PBE,
> Diffie-Hellman, HMAC-MD5, HMAC-SHA1)
> 2004/10/30 00:10:06:777 CDT [DEBUG] HttpClient - SunJGSS 1.0: Sun  
> (Kerberos v5)
> 2004/10/30 00:10:06:787 CDT [DEBUG] DefaultHttpParams - Set parameter
> http.useragent = Jakarta Commons-HttpClient/3.0-alpha2
> 2004/10/30 00:10:06:787 CDT [DEBUG] DefaultHttpParams - Set parameter
> http.protocol.version = HTTP/1.1
> 2004/10/30 00:10:06:797 CDT [DEBUG] DefaultHttpParams - Set parameter
> http.connection-manager.class = class
> org.apache.commons.httpclient.SimpleHttpConnectionManager
> 2004/10/30 00:10:06:797 CDT [DEBUG] DefaultHttpParams - Set parameter
> http.protocol.cookie-policy = rfc2109
> 2004/10/30 00:10:06:797 CDT [DEBUG] DefaultHttpParams - Set parameter
> http.protocol.element-charset = US-ASCII
> 2004/10/30 00:10:06:797 CDT [DEBUG] DefaultHttpParams - Set parameter
> http.protocol.content-charset = ISO-8859-1
> 2004/10/30 00:10:06:837 CDT [DEBUG] DefaultHttpParams - Set parameter
> http.method.retry-handler =
> org.apache.commons.httpclient.DefaultHttpMethodRetryHandler@5e55ab
> 2004/10/30 00:10:06:837 CDT [DEBUG] DefaultHttpParams - Set parameter
> http.dateparser.patterns = [EEE, dd MMM yyyy HH:mm:ss zzz, EEEE,
> dd-MMM-yy HH:mm:ss zzz, EEE MMM d HH:mm:ss yyyy, EEE, dd-MMM-yyyy
> HH:mm:ss z, EEE, dd-MMM-yyyy HH-mm-ss z, EEE, dd MMM yy HH:mm:ss z,
> EEE dd-MMM-yyyy HH:mm:ss z, EEE dd MMM yyyy HH:mm:ss z, EEE
> dd-MMM-yyyy HH-mm-ss z, EEE dd-MMM-yy HH:mm:ss z, EEE dd MMM yy
> HH:mm:ss z, EEE,dd-MMM-yy HH:mm:ss z, EEE,dd-MMM-yyyy HH:mm:ss z, EEE,
> dd-MM-yyyy HH:mm:ss z]
> 2004/10/30 00:10:10:623 CDT [DEBUG] header - >> "POST /  
> HTTP/1.1[\r][\n]"
> 2004/10/30 00:10:10:623 CDT [DEBUG] HttpMethodBase - Adding Host  
> request header
> 2004/10/30 00:10:10:673 CDT [DEBUG] header - >> "Content-Type:
> x-Visa-II/x-auth[\r][\n]"
> 2004/10/30 00:10:10:673 CDT [DEBUG] header - >> "User-Agent: Jakarta
> Commons-HttpClient/3.0-alpha2[\r][\n]"
> 2004/10/30 00:10:10:673 CDT [DEBUG] header - >> "Host:
> ssltest.tnsi.com:5004[\r][\n]"
> 2004/10/30 00:10:10:673 CDT [DEBUG] header - >> "Content-Length:  
> 104[\r][\n]"
> 2004/10/30 00:10:11:003 CDT [DEBUG] header - >> "[\r][\n]"
> 2004/10/30 00:10:11:003 CDT [DEBUG] EntityEnclosingMethod - Request  
> body sent
> 2004/10/30 00:10:11:294 CDT [DEBUG] header - << "[0x5][\r][\n]"
> 2004/10/30 00:10:11:304 CDT [DEBUG] header - << "null[\r][\n]"
> 2004/10/30 00:10:11:304 CDT [DEBUG] HttpMethodDirector - Closing the  
> connection.
> 2004/10/30 00:10:11:304 CDT [DEBUG] HttpConnection - Releasing
> connection back to connection manager.
>
>
> This is the stack trace:
>
> org.apache.commons.httpclient.ProtocolException: The server
> ssltest.tnsi.com failed to respond with a valid HTTP response
> 	at  
> org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodB 
> ase.java:1850)
> 	at  
> org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBas 
> e.java:1599)
> 	at  
> org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.jav 
> a:1010)
> 	at  
> org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpM 
> ethodDirector.java:392)
> 	at  
> org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMeth 
> odDirector.java:178)
> 	at  
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java: 
> 437)
> 	at  
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java: 
> 324)
> 	at com.ta.vital.net.TestConnection.testConnect(TestConnection.java:65)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at  
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja 
> va:39)
> 	at  
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso 
> rImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:324)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:208)
> 	at junit.framework.TestSuite.run(TestSuite.java:203)
> 	at  
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteT 
> estRunner.java:421)
> 	at  
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRu 
> nner.java:305)
> 	at  
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestR 
> unner.java:186)
>
>
>
> Things i've already done and tried:
>
> I've imported the certificate from the test server into my cacerts  
> keystore.
>
> Does anyone have any idea why i'm getting connection reset?  Could it
> possibly be a byte order issue?
>
> I've been running around in circles on this, so any help or comments
> would be greatly appreciated!
>
> Thanks in advance.
>
> -Ben
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:  
> httpclient-user-help@jakarta.apache.org
>


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