(SocketWrapperBase<?> socketWrapper)
| 257 | |
| 258 | |
| 259 | @Override |
| 260 | public SocketState service(SocketWrapperBase<?> socketWrapper) throws IOException { |
| 261 | RequestInfo rp = request.getRequestProcessor(); |
| 262 | rp.setStage(org.apache.coyote.Constants.STAGE_PARSE); |
| 263 | |
| 264 | // Setting up the I/O |
| 265 | setSocketWrapper(socketWrapper); |
| 266 | |
| 267 | // Flags |
| 268 | keepAlive = true; |
| 269 | openSocket = false; |
| 270 | readComplete = true; |
| 271 | boolean keptAlive = false; |
| 272 | SendfileState sendfileState = SendfileState.DONE; |
| 273 | |
| 274 | while (!getErrorState().isError() && keepAlive && !isAsync() && upgradeToken == null && |
| 275 | sendfileState == SendfileState.DONE && !protocol.isPaused()) { |
| 276 | |
| 277 | // Parsing the request header |
| 278 | try { |
| 279 | if (!inputBuffer.parseRequestLine(keptAlive, protocol.getConnectionTimeout(), |
| 280 | protocol.getKeepAliveTimeout())) { |
| 281 | if (inputBuffer.getParsingRequestLinePhase() == -1) { |
| 282 | return SocketState.UPGRADING; |
| 283 | } else if (handleIncompleteRequestLineRead()) { |
| 284 | break; |
| 285 | } |
| 286 | } |
| 287 | |
| 288 | // Process the Protocol component of the request line |
| 289 | // Need to know if this is an HTTP 0.9 request before trying to |
| 290 | // parse headers. |
| 291 | prepareRequestProtocol(); |
| 292 | |
| 293 | if (protocol.isPaused()) { |
| 294 | // 503 - Service unavailable |
| 295 | response.setStatus(503); |
| 296 | setErrorState(ErrorState.CLOSE_CLEAN, null); |
| 297 | } else { |
| 298 | keptAlive = true; |
| 299 | // Set this every time in case limit has been changed via JMX |
| 300 | request.getMimeHeaders().setLimit(protocol.getMaxHeaderCount()); |
| 301 | // Don't parse headers for HTTP/0.9 |
| 302 | if (!http09 && !inputBuffer.parseHeaders()) { |
| 303 | // We've read part of the request, don't recycle it |
| 304 | // instead associate it with the socket |
| 305 | openSocket = true; |
| 306 | readComplete = false; |
| 307 | break; |
| 308 | } |
| 309 | if (!protocol.getDisableUploadTimeout()) { |
| 310 | socketWrapper.setReadTimeout(protocol.getConnectionUploadTimeout()); |
| 311 | } |
| 312 | } |
| 313 | } catch (IOException ioe) { |
| 314 | if (log.isDebugEnabled()) { |
| 315 | log.debug(sm.getString("http11processor.header.parse"), ioe); |
| 316 | } |
nothing calls this directly
no test coverage detected