I have a piece of code that hits my LinkSys router to get the IP address and e-mail it if it has changed.
When using HTTPClient 2.0 RC1, it ran fine. When I upgraded to RC2, I get the message "WARNING: Response content length is not known" I've isolated the two calls that result in the warning. They are: int status = client.executeMethod( get ); and get.getResponseBodyAsString(); Is there anything I can do to make this warning "go away"? Here is the main procedure, to give you a better idea of what I'm doing: String strHTML = new String(); String strIP = new String(); int statusCode = 0; System.out.println("***** LSRouter start *****"); HttpClient client = new HttpClient(); client.getState().setCredentials("Linksys BEFSR41/BEFSR11/BEFSRU31", "192.168.1.1", new UsernamePasswordCredentials("user", "pass")); GetMethod get = new GetMethod("http://192.168.1.1/Status.htm"); get.setDoAuthentication( true ); //client.setStrictMode(true); <--- no effect when enabled //get.setStrictMode(true); <--- no effect when enabled // execute the GET int status = client.executeMethod( get ); // print the status and response statusCode = get.getStatusCode(); System.out.println("Status = " + statusCode); strHTML = StripHTML(get.getResponseBodyAsString()); strIP = locateIP(strHTML); System.out.println("\n" + strIP); And the wire output: 2003/11/07 00:00:12:582 EST [DEBUG] HttpClient - -Java version: 1.4.2_02 2003/11/07 00:00:12:592 EST [DEBUG] HttpClient - -Java vendor: Sun Microsystems Inc. 2003/11/07 00:00:12:592 EST [DEBUG] HttpClient - -Java class path: D:\j2sdk1.4.2_02\jre\lib\rt.jar;D:\j2sdk1.4.2_02\lib\tools.jar;D:\Apache_Too ls\commons-httpclient-2.0-rc2\commons-httpclient-2.0-rc2.jar;D:\Apache_Tools \commons-httpclient-2.0-rc1\commons-httpclient-2.0-rc1.jar;D:\Apache_Tools\c ommons-logging-1.0.3\commons-logging.jar;H:\Development\Java\LSRouter\classe s 2003/11/07 00:00:12:592 EST [DEBUG] HttpClient - -Operating system name: Windows 2000 2003/11/07 00:00:12:592 EST [DEBUG] HttpClient - -Operating system architecture: x86 2003/11/07 00:00:12:592 EST [DEBUG] HttpClient - -Operating system version: 5.0 2003/11/07 00:00:13:844 EST [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) 2003/11/07 00:00:13:844 EST [DEBUG] HttpClient - -SunJSSE 1.42: Sun JSSE provider(implements RSA Signatures, PKCS12, SunX509 key/trust factories, SSLv3, TLSv1) 2003/11/07 00:00:13:844 EST [DEBUG] HttpClient - -SunRsaSign 1.42: SUN's provider for RSA signatures 2003/11/07 00:00:13:854 EST [DEBUG] HttpClient - -SunJCE 1.42: SunJCE Provider (implements DES, Triple DES, AES, Blowfish, PBE, Diffie-Hellman, HMAC-MD5, HMAC-SHA1) 2003/11/07 00:00:13:884 EST [DEBUG] HttpClient - -SunJGSS 1.0: Sun (Kerberos v5) 2003/11/07 00:00:14:555 EST [DEBUG] HttpConnection - -HttpConnection.setSoTimeout(0) 2003/11/07 00:00:14:785 EST [DEBUG] HttpMethodBase - -Execute loop try 1 2003/11/07 00:00:14:795 EST [DEBUG] wire - ->> "GET /Status.htm HTTP/1.1[\r][\n]" 2003/11/07 00:00:14:826 EST [DEBUG] HttpMethodBase - -Adding Host request header 2003/11/07 00:00:14:996 EST [DEBUG] wire - ->> "User-Agent: Jakarta Commons-HttpClient/2.0rc2[\r][\n]" 2003/11/07 00:00:15:006 EST [DEBUG] wire - ->> "Host: 192.168.1.1[\r][\n]" 2003/11/07 00:00:15:006 EST [DEBUG] wire - ->> "[\r][\n]" 2003/11/07 00:00:15:026 EST [DEBUG] wire - -<< "HTTP/1.1 401 Authorization Required[\r][\n]" 2003/11/07 00:00:15:036 EST [DEBUG] wire - -<< "WWW-Authenticate: Basic realm="Linksys BEFSR41/BEFSR11/BEFSRU31"[\r][\n]" 2003/11/07 00:00:15:046 EST [DEBUG] wire - -<< "Content-type: text/html[\r][\n]" 2003/11/07 00:00:15:046 EST [DEBUG] wire - -<< "Expires: Thu, 13 Dec 1969 10:29:00 GMT[\r][\n]" 2003/11/07 00:00:15:046 EST [DEBUG] wire - -<< "Connection: close[\r][\n]" 2003/11/07 00:00:15:256 EST [DEBUG] wire - -<< "Pragma: no-cache[\r][\n]" 2003/11/07 00:00:15:256 EST [WARN] HttpMethodBase - -Response content length is not known 2003/11/07 00:00:15:256 EST [DEBUG] HttpMethodBase - -Force-close connection: true 2003/11/07 00:00:15:326 EST [DEBUG] HttpMethodBase - -Authorization required 2003/11/07 00:00:15:506 EST [DEBUG] HttpAuthenticator - -Authenticating with the 'Linksys BEFSR41/BEFSR11/BEFSRU31' authentication realm at 192.168.1.1 2003/11/07 00:00:15:577 EST [DEBUG] HttpMethodBase - -HttpMethodBase.execute(): Server demanded authentication credentials, will try again. 2003/11/07 00:00:15:587 EST [DEBUG] HttpMethodBase - -Should force-close connection. 2003/11/07 00:00:15:587 EST [DEBUG] HttpMethodBase - -Execute loop try 2 2003/11/07 00:00:15:587 EST [DEBUG] HttpMethodBase - -Opening the connection. 2003/11/07 00:00:15:657 EST [DEBUG] wire - ->> "GET /Status.htm HTTP/1.1[\r][\n]" 2003/11/07 00:00:15:657 EST [DEBUG] HttpMethodBase - -Request to add Host header ignored: header already added 2003/11/07 00:00:15:667 EST [DEBUG] wire - ->> "User-Agent: Jakarta Commons-HttpClient/2.0rc2[\r][\n]" 2003/11/07 00:00:15:667 EST [DEBUG] wire - ->> "Host: 192.168.1.1[\r][\n]" 2003/11/07 00:00:15:797 EST [DEBUG] wire - ->> "Authorization: Basic YWRtaW46amVzc2llOTQ=[\r][\n]" 2003/11/07 00:00:15:797 EST [DEBUG] wire - ->> "[\r][\n]" Status = 200 2003/11/07 00:00:15:897 EST [DEBUG] wire - -<< "HTTP/1.1 200 OK[\r][\n]" 2003/11/07 00:00:15:907 EST [DEBUG] wire - -<< "Content-type: text/html[\r][\n]" 2003/11/07 00:00:15:907 EST [DEBUG] wire - -<< "Expires: Thu, 13 Dec 1969 10:29:00 GMT[\r][\n]" 2003/11/07 00:00:15:907 EST [DEBUG] wire - -<< "Connection: close[\r][\n]" 2003/11/07 00:00:15:907 EST [DEBUG] wire - -<< "Pragma: no-cache[\r][\n]" 2003/11/07 00:00:15:907 EST [WARN] HttpMethodBase - -Response content length is not known 2003/11/07 00:00:15:907 EST [DEBUG] HttpMethodBase - -Force-close connection: true 2003/11/07 00:00:15:917 EST [DEBUG] HttpMethodBase - -Buffering response body 2003/11/07 00:00:16:288 EST [DEBUG] wire - -<< "<html><head><style>A:active;A:link;{text-decoration:none;}A:visited{text-de coration:none;}</style></head><script src=Gozila.js></script><script language=JavaScript>function pppoeAction(F,I){[0x9]F.pppoeAct.value = I;[0x9]F.submit();}function showAlert(){alert('');}function DHCPAct(F,I){[0x9]F.dhcpAction.value = I;[0x9]F.submit();}</script><body bgcolor=black><center><table border=0 cellspacing=0 cellpadding=0 width=700><tr><td colspan=2 background='tmp.gif' width=100% height=54><table border=0 cellspacing=3 width=700 height=54><tr><td colspan=11 height=22></td></tr><tr><td width=175 align=center height=23 background=''> </td><td align=center width=50 height=23 bgcolor=a5a4a1 background=''><a href='index.htm'><font face=verdana color=black size=1><b>Setup</a></td><td align=center width=50 height=23 bgcolor=a5a4a1 background=''><a href='Passwd.htm'><font face=verdana color=black size=1><b>Password</a></td><td align=center width=50 height=23 bgcolor=white background=''><a href='Status.htm'><font face=verdana color=f79400 s" 2003/11/07 00:00:16:578 EST [DEBUG] wire - -<< "ize=1><b>Status</a></td><td align=center width=50 height=23 bgcolor=a5a4a1 background=''><a href='DHCP.htm'><font face=verdana color=black size=1><b>DHCP</a></td><td align=center width=50 height=23 bgcolor=a5a4a1 background=''><a href='Log.htm'><font face=verdana color=black size=1><b>Log</a></td><td align=center width=50 height=23 bgcolor=a5a4a1 background=''><a href='Security.htm'><font face=verdana color=black size=1><b>Security</a></td><td align=center width=50 height=23 bgcolor=a5a4a1 background=''><a href='Help.htm'><font face=verdana color=black size=1><b>Help</a></td><td align=center height=23 background=''> </td><td align=center width=50 height=23 bgcolor=f79400 background=''><a href='Filters.htm'><font face=verdana color=black size=1><b>Advanced</a></td><td width=30 align=center height=23 background=''> </td></tr></table><tr><th bgcolor=black width=23% height=100><font size=5 face=verdana color=white>STATUS</th><th bgcolor=white valign=top>[0x9]<table cellpadding=3 width=94%><tr><td><font size=2 face=verdana color=black>This screen displays the router's current status and settings. This information is read-only.[0x9]</td></tr></table></th></tr><tr><th colspan=2><table border=1 bgcolor=black cellspacing=3 width=100%><tr><th><table border=0 bgcolor=white cellspacing=0 width=100%><tr><th bgcolor=6666cc width=23% align=right><font color=white face=Arial size=2>Host Name: </th><td> <font face=verdana size=2><b></td></tr><tr><th bgcolor=6666cc align=right><font color=white face=Arial size=2>Firmware Version: </th><td> <font face=verdana size=2><b>1.45.6, Jun 24 2003</td></tr><tr><th bgcolor=6666cc align=right><font color=white face=Arial size=2><br>Login: </th><td><font face=verdana size=2><b><br> Disable</td></tr><!--LAN head--><tr><th bgcolor=6666cc align=right><font color=white face=Arial size=2><br>LAN: </th><td><br> <font face=verdana size=1>(MAC Address: 00-20-78-D6-E1-DC)</td></tr><tr><th bgcolor=6666cc> </th><td><table width=90%><tr><td bgcolor=6666cc width=47%> <font color=white face=verdana size=2>IP Address:</td><td><font face=verdana size=2>192.168.1.1</td></tr><tr><td bgcolor=6666cc> <font color=white face=verdana size=2>Subnet Mask:</td><td><font face=verdana size=2>255.255.255.0</td></tr><tr><td bgcolor=6666cc> <font color=white face=verdana size=2>DHCP server:</td><td><font face=verdana size=2>Disabled</td></tr></table></td></tr><!--LAN tail--><!--WAN head--><tr><th bgcolor=6666cc align=right><font color=white face=Arial size=2><br>WAN: </th><td><br> <font face=verdana size=1>(MAC Address: 00-60-67-62-52-0D)</td></tr><tr><th bgcolor=6666cc> </th><td><table width=90%><tr><td bgcolor=6666cc width=47%> <font color=white face=verdana size=2>IP Address:</td><td><font face=verdana size=2>24.43.14.227</td></tr><tr><td bgcolor=6666cc> <font color=white face=verdana size=2>Subnet Mask:</td><td><font face=verdana size=2>255.255.252.0</td></tr><tr><td bgcolor=6666cc> <font color=white face=verdana size=2>Default Gateway:</td><td><font face=verdana size=2>24.43.12.1</td></tr><tr><td bgcolor=6666cc> <font color=white face=verdana size=2>DNS:</td><td><font face=verdana size=2>24.153.22.195<br>24.153.23.66<br>0.0.0.0</td></tr><tr><td bgcolor=6666cc> <font color=white face=verdana size=2>DHCP Remaining Time:</td><td><font face=verdana size=2> 3 days 19:02:36</td></tr></table></td></tr><!--WAN tail--><tr><th bgcolor=6666cc> </th><td> <form method=get action=Gozila.cgi> <input type=hidden name=dhcpAction><input type=button value=' DHCP Release ' onClick=DHCPAct(this.form,0)> <input type=button value=' DHCP Renew ' onClick=DHCPAct(this.form,1)> </form><form> </form><p> </td></tr></table></th></tr></table></th></tr></table></center></body></html >" 2003/11/07 00:00:16:668 EST [DEBUG] HttpMethodBase - -Should force-close connection. 2003/11/07 00:00:16:698 EST [DEBUG] HttpMethodBase - -Default charset used: ISO-8859-1 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]