Juergen

I have tried my best to reproduce the alleged bug in my development environment 
(which, I have to say, does not include Jakarta-Slide). Please see the test cases I 
have used. It's been run with the following system properties to generate the 
following dump

-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog 
-Dorg.apache.commons.logging.simplelog.log.httpclient.wire=debug 
-Dorg.apache.commons.logging.simplelog.log.org.apache.commons.httpclient=debug


[WARN] CookiePolicy - -Unrecognized cookiespec property 'null' - using default
[DEBUG] HttpMethod - -Default charset used: ISO-8859-1
[DEBUG] HttpConnection - -HttpConnectionManager.getConnection:  creating  connection 
for localhost:8080 via null:-1 using protocol: http:80
[DEBUG] HttpConnection - -HttpConnection.setSoTimeout(0)
[DEBUG] HttpMethod - -Execute loop try 1
[DEBUG] wire - ->> "PUT /httpclienttest/auth/basic HTTP/1.1
" [\r\n]
[DEBUG] HttpMethod - -Adding Host request header
[DEBUG] wire - ->> "Content-Length: 51
" [\r\n]
[DEBUG] wire - ->> "Host: localhost:8080
" [\r\n]
[DEBUG] wire - ->> "User-Agent: Jakarta Commons-HttpClient/2.0alpha2
" [\r\n]
[DEBUG] wire - ->> "Expect: 100-continue
" [\r\n]
[DEBUG] wire - ->> [\r\n]
[DEBUG] EntityEnclosingMethod - -Expecting response
[DEBUG] HttpConnection - -Response available
[DEBUG] HttpMethod - -Response available
[DEBUG] wire - -<< "HTTP/1.1 100 Continue" [\r\n]
[DEBUG] EntityEnclosingMethod - -Request body sent
[DEBUG] wire - -<< "HTTP/1.1 401 Unauthorized" [\r\n]
[DEBUG] wire - -<< "www-authenticate: Basic realm="BasicAuthServlet"" [\r\n]
[DEBUG] wire - -<< "Content-Type: text/html" [\r\n]
[DEBUG] wire - -<< "Content-Length: 161" [\r\n]
[DEBUG] wire - -<< "Date: Fri, 31 Jan 2003 11:25:49 GMT" [\r\n]
[DEBUG] wire - -<< "Server: Apache Coyote/1.0" [\r\n]
[DEBUG] HttpMethod - -Authorization required
[DEBUG] Authenticator - -Attempting to parse authenticate header: 'www-authenticate: 
Basic realm="BasicAuthServlet"
'
[DEBUG] Authenticator - -atStart =0, atQuote1 =12, atQuote2=29, atComma =30
[DEBUG] Authenticator - -basic=>Basic realm="BasicAuthServlet"
[DEBUG] Authenticator - -Parsed realm 'BasicAuthServlet' from challenge 'Basic 
realm="BasicAuthServlet"'
[DEBUG] HttpMethod - -HttpMethodBase.execute(): Server demanded authentication 
credentials, will try again.
[DEBUG] wire - -<< <html>
<head><title>BasicAuth Servlet: PUT</title></head>
<body>
<p>This is a response to an HTTP PUT request.</p>
<p>Not authorized.</p>
</body>
</html>

[DEBUG] HttpMethod - -Execute loop try 2
[DEBUG] wire - ->> "PUT /httpclienttest/auth/basic HTTP/1.1
" [\r\n]
[DEBUG] HttpMethod - -Request to add Host header ignored: header already added
[DEBUG] wire - ->> "Authorization: Basic amFrYXJ0YTpjb21tb25z
" [\r\n]
[DEBUG] wire - ->> "Content-Length: 51
" [\r\n]
[DEBUG] wire - ->> "Host: localhost:8080
" [\r\n]
[DEBUG] wire - ->> "User-Agent: Jakarta Commons-HttpClient/2.0alpha2
" [\r\n]
[DEBUG] wire - ->> "Expect: 100-continue
" [\r\n]
[DEBUG] wire - ->> [\r\n]
[DEBUG] EntityEnclosingMethod - -Expecting 100-continue
[DEBUG] HttpConnection - -Response available
[DEBUG] HttpMethod - -Response available
[DEBUG] wire - -<< "HTTP/1.1 100 Continue" [\r\n]
[DEBUG] EntityEnclosingMethod - -Request body sent
[DEBUG] wire - -<< "HTTP/1.1 200 OK" [\r\n]
[DEBUG] wire - -<< "Content-Type: text/html" [\r\n]
[DEBUG] wire - -<< "Content-Length: 189" [\r\n]
[DEBUG] wire - -<< "Date: Fri, 31 Jan 2003 11:25:49 GMT" [\r\n]
[DEBUG] wire - -<< "Server: Apache Coyote/1.0" [\r\n]
[DEBUG] wire - -<< <html>
<head><title>BasicAuth Servlet: PUT</title></head>
<body>
<p>This is a response to an HTTP PUT request.</p>
<p>You have authenticated as "jakarta:commons"</p>
</body>
</html>

[DEBUG] HttpMethod - -buffering response body
[DEBUG] HttpMethod - -Default charset used: ISO-8859-1
<html>
<head><title>BasicAuth Servlet: PUT</title></head>
<body>
<p>This is a response to an HTTP PUT request.</p>
<p>You have authenticated as "jakarta:commons"</p>
</body>
</html>


Everything appears to be kosher as far as I can judge. Tomcat 4.1.12 does send 100 
status code when expected

Can you try running the same test case in your environment and let me analyse the 
output it produces? Currently I tend to assume that the problem may be specific to 
your development environment. Therefore, I would need a bit more help form your side 
to narrow it down

Cheers

Oleg


=============================================================================== 
Original mail =============

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:[EMAIL PROTECTED]] 
Sent:   Wednesday, January 01, 2003 11.47 AM
To:     [EMAIL PROTECTED]
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:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

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

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

Reply via email to