hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Smith" <ch...@mindiq.com>
Subject Problem with proxy server and PUT method.
Date Fri, 29 Nov 2002 16:46:50 GMT
I'm having a problem with using HttpClient (all versions I've tried, but
most recently nightly build from 11/27) doing a PUT method through a squid
proxy (2.4.6, pretty standard configuration, not blocking anything)

The request hangs for a very long time, then comes back with:

[WARN] HttpMethod - -Recoverable exception caught when reading response
org.apache.commons.httpclient.HttpRecoverableException: Error in parsing the
status line from the response: unable to find line starting with "HTTP/"
at
org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.j
ava:1754)
at
org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.jav
a:1527)
at
org.apache.commons.httpclient.HttpMethodBase.processRequest(HttpMethodBase.j
ava:2182)
at
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:820
)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:455)
at test.Test.main(Test.java:26)
Exception in thread "main"

Here's some sample code I can use to produce the error -- any server that
will accept a PUT request will do; the address in the test code is internal,
so you won't be able to access it:

package test;

import java.io.File;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.methods.PutMethod;

public class Test
{
    public static void main(String[] args)
        throws Exception
    {
        HttpClient client = new HttpClient();
        client.startSession("10.0.0.100", 90, "10.0.0.1", 3128);
        try
        {
            PutMethod meth = new
PutMethod("/MindIQ/action-upload-file/bb/1.0/readme.txt");
            meth.setRequestBody(new File("c:\\warcraft\\readme.txt"));
            client.getState().setCredentials(null, new
UsernamePasswordCredentials(
                "cdsmith", "password"));
            int response = client.executeMethod(meth);
            System.out.println("Response code: " + response);
        }
        finally
        {
            client.endSession();
        }
    }
}

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation



Mime
View raw message