Index: AjpProcessor.java =================================================================== --- AjpProcessor.java (revision 2043) +++ AjpProcessor.java (working copy) @@ -355,126 +355,123 @@ * * @throws IOException error during an I/O operation */ - public boolean process(Socket socket) - throws IOException { - RequestInfo rp = request.getRequestProcessor(); - rp.setStage(org.apache.coyote.Constants.STAGE_PARSE); + public void process(Socket socket) + throws IOException { + RequestInfo rp = request.getRequestProcessor(); + rp.setStage(org.apache.coyote.Constants.STAGE_PARSE); - // Setting up the socket - this.socket = socket; - input = socket.getInputStream(); - output = socket.getOutputStream(); - int soTimeout = -1; - if (keepAliveTimeout > 0) { - soTimeout = socket.getSoTimeout(); - } + // Setting up the socket + this.socket = socket; + input = socket.getInputStream(); + output = socket.getOutputStream(); + int soTimeout = -1; + if (keepAliveTimeout > 0) { + soTimeout = socket.getSoTimeout(); + } - // Error flag - error = false; + // Error flag + error = false; - while (started && !error) { + while (started && !error) { - // Parsing the request header - try { - // Set keep alive timeout if enabled - if (keepAliveTimeout > 0) { - socket.setSoTimeout(keepAliveTimeout); - } - // Get first message of the request - if (!readMessage(requestHeaderMessage)) { - // This means a connection timeout - rp.setStage(org.apache.coyote.Constants.STAGE_ENDED); - break; - } - // Set back timeout if keep alive timeout is enabled - if (keepAliveTimeout > 0) { - socket.setSoTimeout(soTimeout); - } - // Check message type, process right away and break if - // not regular request processing - int type = requestHeaderMessage.getByte(); - if (type == Constants.JK_AJP13_CPING_REQUEST) { - try { - output.write(pongMessageArray); - } catch (IOException e) { - error = true; + // Parsing the request header + try { + // Set keep alive timeout if enabled + if (keepAliveTimeout > 0) { + socket.setSoTimeout(keepAliveTimeout); } - continue; - } else if(type != Constants.JK_AJP13_FORWARD_REQUEST) { - // Usually the servlet didn't read the previous request body - if(log.isDebugEnabled()) { - log.debug("Unexpected message: "+type); + // Get first message of the request + if (!readMessage(requestHeaderMessage)) { + // This means a connection timeout + rp.setStage(org.apache.coyote.Constants.STAGE_ENDED); + break; } - continue; - } + // Set back timeout if keep alive timeout is enabled + if (keepAliveTimeout > 0) { + socket.setSoTimeout(soTimeout); + } + // Check message type, process right away and break if + // not regular request processing + int type = requestHeaderMessage.getByte(); + if (type == Constants.JK_AJP13_CPING_REQUEST) { + try { + output.write(pongMessageArray); + } catch (IOException e) { + error = true; + } + continue; + } else if(type != Constants.JK_AJP13_FORWARD_REQUEST) { + // Usually the servlet didn't read the previous request body + if(log.isDebugEnabled()) { + log.debug("Unexpected message: "+type); + } + continue; + } - request.setStartTime(System.currentTimeMillis()); - } catch (IOException e) { - error = true; - break; - } catch (Throwable t) { - log.debug(sm.getString("ajpprocessor.header.error"), t); - // 400 - Bad Request - response.setStatus(400); - error = true; - } - - // Setting up filters, and parse some request headers - rp.setStage(org.apache.coyote.Constants.STAGE_PREPARE); - try { - prepareRequest(); - } catch (Throwable t) { - log.debug(sm.getString("ajpprocessor.request.prepare"), t); - // 400 - Internal Server Error - response.setStatus(400); - error = true; - } - - // Process the request in the adapter - if (!error) { - try { - rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE); - adapter.service(request, response); - } catch (InterruptedIOException e) { + request.setStartTime(System.currentTimeMillis()); + } catch (IOException e) { error = true; + break; } catch (Throwable t) { - log.error(sm.getString("ajpprocessor.request.process"), t); - // 500 - Internal Server Error - response.setStatus(500); + log.debug(sm.getString("ajpprocessor.header.error"), t); + // 400 - Bad Request + response.setStatus(400); error = true; } - } - // Finish the response if not done yet - if (!finished) { + // Setting up filters, and parse some request headers + rp.setStage(org.apache.coyote.Constants.STAGE_PREPARE); try { - finish(); + prepareRequest(); } catch (Throwable t) { + log.debug(sm.getString("ajpprocessor.request.prepare"), t); + // 400 - Internal Server Error + response.setStatus(400); error = true; } - } - // If there was an error, make sure the request is counted as - // and error, and update the statistics counter - if (error) { - response.setStatus(500); - } - request.updateCounters(); + // Process the request in the adapter + if (!error) { + try { + rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE); + adapter.service(request, response); + } catch (InterruptedIOException e) { + error = true; + } catch (Throwable t) { + log.error(sm.getString("ajpprocessor.request.process"), t); + // 500 - Internal Server Error + response.setStatus(500); + error = true; + } + } - rp.setStage(org.apache.coyote.Constants.STAGE_KEEPALIVE); - recycle(); + // Finish the response if not done yet + if (!finished) { + try { + finish(); + } catch (Throwable t) { + error = true; + } + } - } + // If there was an error, make sure the request is counted as + // and error, and update the statistics counter + if (error) { + response.setStatus(500); + } + request.updateCounters(); - rp.setStage(org.apache.coyote.Constants.STAGE_ENDED); - recycle(); - input = null; - output = null; - - return true; + rp.setStage(org.apache.coyote.Constants.STAGE_KEEPALIVE); + recycle(); - } + } + rp.setStage(org.apache.coyote.Constants.STAGE_ENDED); + recycle(); + input = null; + output = null; + + } // ----------------------------------------------------- ActionHook Methods Index: AjpProtocol.java =================================================================== --- AjpProtocol.java (revision 2043) +++ AjpProtocol.java (working copy) @@ -363,7 +363,8 @@ ((ActionHook) processor).action(ActionCode.ACTION_START, null); } - return processor.process(socket); + processor.process(socket); + return false; } catch(java.net.SocketException e) { // SocketExceptions are normal