hi,

it looks as if a new bug has been introduced switching from 0.8.x to 0.9.x. 
post requests with content-length larger than 4k seem to fail with a read 
timeout when we are trying to read an object from the request's input 
stream. a timeout doesn't really make sense here because this is a local 
request (client and server on the same fast machine) .the very same code 
used to work (tested a 100 times) with orion 0.8.x.

here's the client code that makes the http request:

        RemoteRequest request = new RemoteRequest(name, args);

        HttpURLConnection conn = (HttpURLConnection)url.openConnection();

        conn.setUseCaches(false);
        conn.setDoInput(true);
        conn.setDoOutput(true);
        
        ByteArrayOutputStream barr = new ByteArrayOutputStream();
        ObjectOutputStream oout = new ObjectOutputStream(barr);
        
        oout.writeObject(request);
        oout.flush();

        byte buf[] = barr.toByteArray();

        conn.setRequestProperty("Content-type",
                                "application/octet-stream");

        conn.setRequestProperty("Content-length", ""+buf.length);

        Log.trace("content-length:" + buf.length);

        if(cookie != null){
            System.err.println("**sending cookie: "+cookie+" **");
            conn.setRequestProperty("Cookie", cookie);
        }else{
            System.err.println("**no cookie**");
        }

        if(getCredentials() != null){
            BASE64Encoder encoder = new BASE64Encoder();
            String encCredentials = encoder.encode(getCredentials().getBytes());
        
            String auth = "Basic "+encCredentials;
        
            conn.setRequestProperty("Authorization", auth);
        }
        
        DataOutputStream dout = new DataOutputStream(conn.getOutputStream());

        dout.write(buf);
        dout.flush();
        dout.close();

here's the servlet code that reads this request:

     public void service(HttpServletRequest req,
                        HttpServletResponse resp)
        throws ServletException, IOException{
        
        ObjectInputStream oin;
        ServletOutputStream out;
        
        oin = new ObjectInputStream(req.getInputStream());
                
        RemoteResponse remoteResponse = null;
        RemoteRequest remoteRequest = null;

        try{
        
               // here it fails with the timeout
            remoteRequest = (RemoteRequest)oin.readObject();


here's the stack trace:

com.evermind.server.http.HttpIOException: Read timed out
         at com.evermind.server.http.di.o1(JAX)
         at com.evermind.server.http.di.read(JAX)
         at java.io.ObjectInputStream.peekCode(ObjectInputStream.java:1274)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:282)
         at 
java.io.ObjectInputStream.inputClassFields(ObjectInputStream.java:183
1)
         at 
java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:50
2)
         at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1166)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
         at java.io.ObjectInputStream.inputArray(ObjectInputStream.java:951)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:357)
         at 
java.io.ObjectInputStream.inputClassFields(ObjectInputStream.java:183
1)
         at 
java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:50
2)
         at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1166)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:232)
         at com.signal7.httptunnel.TunnelServlet.service(TunnelServlet.java:81)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:324)
         at com.evermind.server.http.cv.k2(JAX)
         at com.evermind.server.http.cv.forward(JAX)
         at com.evermind.server.http.c4.m2(JAX)
         at com.evermind.util.b.run(JAX)

thanks,

robert


(-) Robert Krüger
(-) SIGNAL 7 Gesellschaft für Informationstechnologie mbH
(-) Brüder-Knauß-Str. 79 - 64285 Darmstadt,
(-) Tel: 06151 665401, Fax: 06151 665373
(-) [EMAIL PROTECTED], www.signal7.de

Reply via email to