View | Details | Raw Unified | Return to bug 50072
Collapse All | Expand All

(-)java/org/apache/coyote/http11/Http11NioProtocol.java (-7 / +10 lines)
Lines 720-740 Link Here
720
720
721
                SocketState state = processor.process(socket);
721
                SocketState state = processor.process(socket);
722
                if (state == SocketState.LONG) {
722
                if (state == SocketState.LONG) {
723
                    // Associate the connection with the processor. The next request 
723
                    // In the middle of processing a request/response. Keep the
724
                    // processed by this thread will use either a new or a recycled
724
                    // socket associated with the processor.
725
                    // processor.
726
                    //if (log.isDebugEnabled()) log.debug("Not recycling ["+processor+"] Comet="+((NioEndpoint.KeyAttachment)socket.getAttachment(false)).getComet());
727
                    connections.put(socket, processor);
725
                    connections.put(socket, processor);
726
728
                    if (processor.comet) {
727
                    if (processor.comet) {
729
                        NioEndpoint.KeyAttachment att = (NioEndpoint.KeyAttachment)socket.getAttachment(false);
728
                        NioEndpoint.KeyAttachment att = (NioEndpoint.KeyAttachment)socket.getAttachment(false);
730
                        socket.getPoller().add(socket,att.getCometOps());
729
                        socket.getPoller().add(socket,att.getCometOps());
731
                    } else {
730
                    } else {
732
                    	//we should not hold on to the processor objects
733
                    	release(socket);
734
                        socket.getPoller().add(socket);
731
                        socket.getPoller().add(socket);
735
                    }
732
                    }
733
                } else if (state == SocketState.OPEN) {
734
                    // In keep-alive but between requests. OK to recycle
735
                    // processor. Continue to poll for the next request.
736
                    socket.getPoller().add(socket);
737
                    release(socket);
736
                } else {
738
                } else {
737
                    recycledProcessors.offer(processor);
739
                    // Connection closed. OK to recycle the processor.
740
                    release(socket);
738
                }
741
                }
739
                return state;
742
                return state;
740
743
(-)java/org/apache/coyote/http11/InternalNioInputBuffer.java (-10 / +15 lines)
Lines 404-410 Link Here
404
     * @return true if data is properly fed; false if no data is available 
404
     * @return true if data is properly fed; false if no data is available 
405
     * immediately and thread should be freed
405
     * immediately and thread should be freed
406
     */
406
     */
407
    public boolean parseRequestLine(boolean useAvailableData)
407
    public boolean parseRequestLine(boolean useAvailableDataOnly)
408
        throws IOException {
408
        throws IOException {
409
409
410
        //check state
410
        //check state
Lines 418-424 Link Here
418
                
418
                
419
                // Read new bytes if needed
419
                // Read new bytes if needed
420
                if (pos >= lastValid) {
420
                if (pos >= lastValid) {
421
                    if (useAvailableData) {
421
                    if (useAvailableDataOnly) {
422
                        return false;
422
                        return false;
423
                    }
423
                    }
424
                    // Do a simple read with a short timeout
424
                    // Do a simple read with a short timeout
Lines 434-440 Link Here
434
            // Mark the current buffer position
434
            // Mark the current buffer position
435
            
435
            
436
            if (pos >= lastValid) {
436
            if (pos >= lastValid) {
437
                if (useAvailableData) {
437
                if (useAvailableDataOnly) {
438
                    return false;
438
                    return false;
439
                }
439
                }
440
                // Do a simple read with a short timeout
440
                // Do a simple read with a short timeout
Lines 465-471 Link Here
465
                }
465
                }
466
                pos++;
466
                pos++;
467
            }
467
            }
468
            parsingRequestLineStart = pos;
469
            parsingRequestLinePhase = 3;
468
            parsingRequestLinePhase = 3;
470
        }
469
        }
471
        if ( parsingRequestLinePhase == 3 ) {
470
        if ( parsingRequestLinePhase == 3 ) {
Lines 483-495 Link Here
483
                    space = false;
482
                    space = false;
484
                }
483
                }
485
            }
484
            }
486
485
            parsingRequestLineStart = pos;
486
            parsingRequestLinePhase = 4;
487
        }
488
        if (parsingRequestLinePhase == 4) {
487
            // Mark the current buffer position
489
            // Mark the current buffer position
488
            
490
            
489
            int end = 0;
491
            int end = 0;
490
            //
492
            //
491
            // Reading the URI
493
            // Reading the URI
492
            //
494
            //
495
            boolean space = false;
493
            while (!space) {
496
            while (!space) {
494
                // Read new bytes if needed
497
                // Read new bytes if needed
495
                if (pos >= lastValid) {
498
                if (pos >= lastValid) {
Lines 519-528 Link Here
519
            } else {
522
            } else {
520
                request.requestURI().setBytes(buf, parsingRequestLineStart, end - parsingRequestLineStart);
523
                request.requestURI().setBytes(buf, parsingRequestLineStart, end - parsingRequestLineStart);
521
            }
524
            }
522
            parsingRequestLineStart = pos;
525
            parsingRequestLinePhase = 5;
523
            parsingRequestLinePhase = 4;
524
        }
526
        }
525
        if ( parsingRequestLinePhase == 4 ) {
527
        if ( parsingRequestLinePhase == 5 ) {
526
            // Spec says single SP but also be tolerant of multiple and/or HT
528
            // Spec says single SP but also be tolerant of multiple and/or HT
527
            boolean space = true;
529
            boolean space = true;
528
            while (space) {
530
            while (space) {
Lines 537-543 Link Here
537
                    space = false;
539
                    space = false;
538
                }
540
                }
539
            }
541
            }
540
542
            parsingRequestLineStart = pos;
543
            parsingRequestLinePhase = 6;
544
        }
545
        if (parsingRequestLinePhase == 6) { 
541
            // Mark the current buffer position
546
            // Mark the current buffer position
542
            
547
            
543
            end = 0;
548
            end = 0;
Lines 548-554 Link Here
548
            while (!parsingRequestLineEol) {
553
            while (!parsingRequestLineEol) {
549
                // Read new bytes if needed
554
                // Read new bytes if needed
550
                if (pos >= lastValid) {
555
                if (pos >= lastValid) {
551
                    if (!fill(true, false)) //reques line parsing
556
                    if (!fill(true, false)) //request line parsing
552
                        return false;
557
                        return false;
553
                }
558
                }
554
        
559
        

Return to bug 50072