hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kalnichevski, Oleg" <oleg.kalnichev...@bearingpoint.com>
Subject RE: Bug in PUT method with TC
Date Thu, 16 Jan 2003 13:25:03 GMT
Juergen 
I am planning to rewrite PutMethod and PostMethod classes as soon as all the pending patches
land in the CVS HEAD. I'll look into this one as well. So, please, just bear with us

Oleg

-----Original Message-----
From: Pill, Juergen [mailto:Juergen.Pill@softwareag.com]
Sent: Thursday, January 16, 2003 2:20 PM
To: 'Commons HttpClient Project'
Subject: RE: Bug in PUT method with TC


Hello,

Here is the sniffer protocol:


PUT /taminowebdavserver/mypictures/aaa.txt HTTP/1.1
Expect: 100-continue
Host: pcjpl:4001
Content-Length: 2100
User-Agent: Jakarta Commons-HttpClient/2.0M1

HTTP/1.1 401 Unauthorized
Pragma: No-cache
Cache-Control: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
WWW-Authenticate: Basic realm="Slide DAV Server"
Content-Type: text/html
Content-Language: en-US
Transfer-Encoding: chunked
Date: Thu, 16 Jan 2003 13:07:14 GMT
Server: Apache Coyote/1.0

29b
<html><head><title>Apache Tomcat/4.1.12 - Error
report</title><STYLE><!--H1{font-family : sans-serif,Arial,Tahoma;color :
white;background-color : #0086b2;} H3{font-family :
sans-serif,Arial,Tahoma;color : white;background-color : #0086b2;}
BODY{font-family : sans-serif,Arial,Tahoma;color : black;background-color :
white;} B{color : white;background-color : #0086b2;} HR{color : #0086b2;}
--></STYLE> </head><body><h1>HTTP Status 401 - </h1><HR
size="1"
noshade><p><b>type</b> Status report</p><p><b>message</b>
<u></u></p><p><b>description</b> <u>This request
requires HTTP
authentication ().</u></p><HR size="1" noshade><h3>Apache
Tomcat/4.1.12</h3></body></html>
0


PUT /taminowebdavserver/mypictures/aaa.txt HTTP/1.1
Authorization: Basic xxxxxxxxxxxxxxxxx
Expect: 100-continue
Host: pcjpl:4001
Content-Length: 2100
User-Agent: Jakarta Commons-HttpClient/2.0M1



==============>   hanging client (in readStatusLine)



I am using as the server Tomcat 4.1.12 and a head version of Slide from few
months ago. The client is the current http-commons CVS head.



If I am running with   -Dhttpclient.authentication.preemptive=true   the
problem disappears.


PUT /taminowebdavserver/mypictures/aaa.txt HTTP/1.1
Authorization: Basic xxxxxxxxxxxx
Expect: 100-continue
Host: pcjpl:4001
Content-Length: 2100
User-Agent: Jakarta Commons-HttpClient/2.0M1


HTTP/1.1 100 Continue


Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890
Hello this is a test in one line that is longer 12345677890

HTTP/1.1 204 No Content
Pragma: No-cache
Cache-Control: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Set-Cookie: JSESSIONID=BAB6E6105F673CA35797AAE338B820F2;
Path=/taminowebdavserver
Content-Length: 0
Date: Thu, 16 Jan 2003 13:14:58 GMT
Server: Apache Coyote/1.0








Code:





        {
        HttpClient client = new HttpClient();
        HttpState state = new WebdavState();
        Credentials cred = new UsernamePasswordCredentials("xxx", "xxxx");
        client.startSession("pcjpl", 4001);
        state.setCredentials(null, cred);
        client.setState(state);
        PutMethod method = new
PutMethod("/taminowebdavserver/mypictures/aaa.txt");
        String s = "Hello this is a test in one line that is longer
12345677890\n";
        s =
s+s+s+s+s+s+s+s+s+s+s+s+s+s+s+s+s+s+s+s+s+s+s+s+s+s+s+s+s+s+s+s+s+s+s;
        byte[] body = s.getBytes();
        method.setRequestHeader("Content-Length", ""+body.length);
        method.setRequestBody(body);
            try {
                client.executeMethod(method);
                client.endSession();
            } catch (java.io.IOException e) {
                e.printStackTrace();
            }
        }


Any ideas?

Best regards,

Juergen




 -----Original Message-----
From: 	Remy Maucherat [mailto:remm@apache.org] 
Sent:	Wednesday, January 01, 2003 11.47 AM
To:	commons-httpclient-dev@jakarta.apache.org
Subject:	Re: Bug in PUT method with TC

Pill, Juergen wrote:
> Hello,
> 
> I want to report a bug in the PUT method, if running directly with Tomcat
> and Jakarta-Slide servlet.
> 
> The http client API sends an expect 100-continue header. If running under
> Apache the 100 response code is send from the server and the body is
> delivered correctly. If running directly with the TC port (e.g. 8080) the
> 100 response code is not generated, in this case the client does not send
> the body and the server waits infinite.
> 
> Is this a problem in TC or the servlet implementation. 
> Could we make the client API more robust to handle this case?

I think Tomcat works fine. If you send:

GET / HTTP/1.1
Host: localhost:8080
Expect: 100-continue

You get back (I tested 5.0.1-dev and 4.1.18):

HTTP/1.1 100 Continue

HTTP/1.1 302 Déplacé Temporairement
Location: http://localhost:8080/index.jsp
Content-Type: text/plain
Content-Length: 0
Date: Wed, 01 Jan 2003 10:40:40 GMT
Server: Apache Coyote/1.0

Remy


--
To unsubscribe, e-mail:
<mailto:commons-httpclient-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:commons-httpclient-dev-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:commons-httpclient-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-httpclient-dev-help@jakarta.apache.org>


Mime
View raw message