OK, I'm attempting to reverse engineer another client application that accesses 
information over HTTP.

Here is the TCPDUMP of the first request I'm trying to replicate.

10:55:59.390625 IP HEAVYMOVER.1079 > orgmeta.xmlsweb.com.3245: P 1:216(215) ack 
1 win 65535
        0x0000:  4500 00ff 0565 4000 8006 f2e2 c0a8 0004  [EMAIL PROTECTED]
        0x0010:  0c9a 346b 0437 0cad 3131 29ce 3692 a511  ..4k.7..11).6...
        0x0020:  5018 ffff a6ec 0000 4745 5420 2f6f 7267  P.......GET./org
        0x0030:  732e 786d 6c20 4854 5450 2f31 2e31 0d0a  s.xml.HTTP/1.1..
        0x0040:  4163 6365 7074 3a20 2a2f 2a0d 0a41 6363  Accept:.*/*..Acc
        0x0050:  6570                                     ep

Seems simple enough. So I coded it up through httpclient. Here's the log...

2005/10/02 11:15:56:531 EDT [DEBUG] HttpClient - Java version: 1.5.0_05
2005/10/02 11:15:56:531 EDT [DEBUG] HttpClient - Java vendor: Sun Microsystems I
nc.
2005/10/02 11:15:56:531 EDT [DEBUG] HttpClient - Java class path: rex.jar
2005/10/02 11:15:56:531 EDT [DEBUG] HttpClient - Operating system name: Windows
XP
2005/10/02 11:15:56:531 EDT [DEBUG] HttpClient - Operating system architecture:
x86
2005/10/02 11:15:56:531 EDT [DEBUG] HttpClient - Operating system version: 5.1
2005/10/02 11:15:56:640 EDT [DEBUG] HttpClient - SUN 1.5: SUN (DSA key/parameter
 generation; DSA signing; SHA-1, MD5 digests; SecureRandom; X.509 certificates;
JKS keystore; PKIX CertPathValidator; PKIX CertPathBuilder; LDAP, Collection Cer
tStores)
2005/10/02 11:15:56:640 EDT [DEBUG] HttpClient - SunRsaSign 1.5: Sun RSA signatu
re provider
2005/10/02 11:15:56:640 EDT [DEBUG] HttpClient - SunJSSE 1.5: Sun JSSE provider(
PKCS12, SunX509 key/trust factories, SSLv3, TLSv1)
2005/10/02 11:15:56:640 EDT [DEBUG] HttpClient - SunJCE 1.5: SunJCE Provider (im
plements RSA, DES, Triple DES, AES, Blowfish, ARCFOUR, RC2, PBE, Diffie-Hellman,
 HMAC)
2005/10/02 11:15:56:640 EDT [DEBUG] HttpClient - SunJGSS 1.0: Sun (Kerberos v5)
2005/10/02 11:15:56:640 EDT [DEBUG] HttpClient - SunSASL 1.5: Sun SASL provider(
implements client mechanisms for: DIGEST-MD5, GSSAPI, EXTERNAL, PLAIN, CRAM-MD5;
 server mechanisms for: DIGEST-MD5, GSSAPI, CRAM-MD5)
2005/10/02 11:15:56:640 EDT [DEBUG] DefaultHttpParams - Set parameter http.usera
gent = Jakarta Commons-HttpClient/3.0-rc3
2005/10/02 11:15:56:640 EDT [DEBUG] DefaultHttpParams - Set parameter http.proto
col.version = HTTP/1.1
2005/10/02 11:15:56:640 EDT [DEBUG] DefaultHttpParams - Set parameter http.conne
ction-manager.class = class org.apache.commons.httpclient.SimpleHttpConnectionMa
nager
2005/10/02 11:15:56:640 EDT [DEBUG] DefaultHttpParams - Set parameter http.proto
col.cookie-policy = rfc2109
2005/10/02 11:15:56:640 EDT [DEBUG] DefaultHttpParams - Set parameter http.proto
col.element-charset = US-ASCII
2005/10/02 11:15:56:640 EDT [DEBUG] DefaultHttpParams - Set parameter http.proto
col.content-charset = ISO-8859-1
2005/10/02 11:15:56:656 EDT [DEBUG] DefaultHttpParams - Set parameter http.metho
d.retry-handler = [EMAIL PROTECTED]
6096
2005/10/02 11:15:56:656 EDT [DEBUG] DefaultHttpParams - Set parameter http.datep
arser.patterns = [EEE, dd MMM yyyy HH:mm:ss zzz, EEEE, dd-MMM-yy HH:mm:ss zzz, E
EE 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:s
s z, EEE dd-MMM-yyyy HH-mm-ss z, EEE dd-MMM-yy HH:mm:ss z, EEE dd MMM yy HH:mm:s
s 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]
2005/10/02 11:15:56:656 EDT [DEBUG] DefaultHttpParams - Set parameter http.conne
ction.timeout = 25000
2005/10/02 11:15:56:656 EDT [DEBUG] DefaultHttpParams - Set parameter http.proto
col.single-cookie-header = true
2005/10/02 11:15:56:656 EDT [DEBUG] DefaultHttpParams - Set parameter http.proto
col.cookie-policy = rfc2109
2005/10/02 11:15:56:734 EDT [DEBUG] HttpConnection - Open connection to orgmeta.
xmlsweb.com:3245
2005/10/02 11:15:56:750 EDT [DEBUG] header - >> "GET orgs.xml? HTTP/1.1[\r][\n]"

2005/10/02 11:15:56:765 EDT [DEBUG] HttpMethodBase - Adding Host request header
2005/10/02 11:15:56:781 EDT [DEBUG] header - >> "User-Agent: Jakarta Commons-Htt
pClient/3.0-rc3[\r][\n]"
2005/10/02 11:15:56:781 EDT [DEBUG] header - >> "Host: orgmeta.xmlsweb.com:3245[
\r][\n]"
2005/10/02 11:15:56:781 EDT [DEBUG] header - >> "[\r][\n]"
2005/10/02 11:15:58:250 EDT [DEBUG] header - << "HTTP/1.1 400 Bad Request[\r][\n
]"
2005/10/02 11:15:58:250 EDT [DEBUG] header - << "Server: Microsoft-IIS/5.0[\r][\
n]"
2005/10/02 11:15:58:250 EDT [DEBUG] header - << "Date: Sun, 02 Oct 2005 15:15:59
 GMT[\r][\n]"
2005/10/02 11:15:58:250 EDT [DEBUG] header - << "Connection: close[\r][\n]"
2005/10/02 11:15:58:250 EDT [DEBUG] header - << "Content-Type: text/html[\r][\n]
"
2005/10/02 11:15:58:250 EDT [DEBUG] header - << "Content-Length: 87[\r][\n]"
2005/10/02 11:15:58:265 EDT [DEBUG] content - << "<html><head><title>Error</titl
e></head><body>The parameter is incorrect. </body></html>"
2005/10/02 11:15:58:265 EDT [DEBUG] HttpMethodBase - Should close connection in
response to directive: close
2005/10/02 11:15:58:265 EDT [DEBUG] HttpConnection - Releasing connection back t
o connection manager.
Exception in thread "main" java.io.IOException: Attempted read on closed stream.

        at org.apache.commons.httpclient.AutoCloseInputStream.isReadAllowed(Auto
CloseInputStream.java:165)
        at org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInpu
tStream.java:106)
        at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(Unknown Source)
        at sun.nio.cs.StreamDecoder$CharsetSD.implRead(Unknown Source)
        at sun.nio.cs.StreamDecoder.read(Unknown Source)
        at java.io.InputStreamReader.read(Unknown Source)
        at java.io.BufferedReader.fill(Unknown Source)
        at java.io.BufferedReader.readLine(Unknown Source)
        at java.io.BufferedReader.readLine(Unknown Source)
        at retransform.idxloader.ParagonUtil.findImages(ParagonUtil.java:49)
        at rex.IdxFileConverter.main(IdxFileConverter.java:296)

So, what's causing the invalid parameter? The only difference I can see is that 
the httpclient query puts a "?" at the end with no parameters. When I try it 
with or without a question mark in my web browser, I get exactly the same 
results. I'm not sure that's conclusive though, as the browser may be stripping 
it off if there's no parameters.

So, I guess, I'm trying to figure out what the next step is. Anyone know how to 
make httpclient not stick a ? at the end of a GET? Anyone have any other ideas?

Thanks!

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to