www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ronald Tschalaer <Ronald.Tschal...@psi.ch>
Subject other/2066: JDK1.2beta[23] have a bug in the URLConnection - here is simple server side workaround
Date Thu, 16 Apr 1998 03:03:13 GMT

>Number:         2066
>Category:       other
>Synopsis:       JDK1.2beta[23] have a bug in the URLConnection - here is simple server
side workaround
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apache
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Wed Apr 15 20:10:00 PDT 1998
>Last-Modified:
>Originator:     Ronald.Tschalaer@psi.ch
>Organization:
apache
>Release:        1.3beta
>Environment:
All
>Description:
This is NOT an Apache bug, but there is simple BrowseMatch to workaround the
problem.

The http client in the JDK1.2beta2 and beta3 will throw away the first part of
the response body when both the headers and the first part of the body are sent
in the same network packet AND keep-alive's are being used. If either condition
is not met then it works fine.

See also Bug-ID's 4124329 and 4125538 at the java developer connection.
>How-To-Repeat:
The following trivial piece of client code will demonstrate it. Run with
"java URLConnectionBug http://the.server/something"

------ URLConnectionBug.java -----------------------------------------------
/*
 * Run this trivial code against a server which sends the headers and the
 * body in the same packet and which does keep-alive's. This will cause
 * the body to be discarded (truss shows this nicely).
 *
 * See also Bug-ID 4124329 4125538
 */

import java.net.URL;
import java.net.URLConnection;
import java.io.InputStream;

public class URLConnectionBug
{
    public static void main(String args[])  throws Exception
    {
        URL url = new URL(args[0]);
        URLConnection con = url.openConnection();
        con.setRequestProperty("Connection", "close");
        InputStream in = con.getInputStream();

        byte[] buffer = new byte[10000];
        int len = in.read(buffer);

        System.out.println("Got " + len + " bytes in first read:");
        if (len > 0)  System.out.println(new String(buffer, 0, len));
    }
}

----------------------------------------------------------------------------
>Fix:
Add to srm.conf(-dist):

# JDK 1.2beta[23] are broken in that if keep-alive is enabled and the
# header and (part of) the entity arrive in the same packet, then the
# entity data in that packet is discarded. Since Apache tries to send
# these in the same packet (and who knows what the network will do) we
# need to disable keep-alive's

BrowserMatch "Java1\.2beta[23]" nokeepalive
%0
>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, ]
[you need to include <apbugs@Apache.Org> in the Cc line ]
[and leave the subject line UNCHANGED.  This is not done]
[automatically because of the potential for mail loops. ]




Mime
View raw message