MCPcopy Create free account
hub / github.com/apache/tomcat / refillReadBuffer

Method refillReadBuffer

java/org/apache/coyote/ajp/AjpProcessor.java:602–640  ·  view source on GitHub ↗

Get more request body data from the web server and store it in the internal buffer. @param block true if this is blocking IO @return true if there is more data, false if not. @throws IOException An IO error occurred

(boolean block)

Source from the content-addressed store, hash-verified

600 * @throws IOException An IO error occurred
601 */
602 protected boolean refillReadBuffer(boolean block) throws IOException {
603 // When using replay (e.g. after FORM auth) all the data to read has
604 // been buffered so there is no opportunity to refill the buffer.
605 if (replay) {
606 endOfStream = true; // we've read everything there is
607 }
608 if (endOfStream) {
609 return false;
610 }
611
612 if (first) {
613 first = false;
614 long contentLength = request.getContentLengthLong();
615 // - When content length > 0, AJP sends the first body message
616 // automatically.
617 // - When content length == 0, AJP does not send a body message.
618 // - When content length is unknown, AJP does not send the first
619 // body message automatically.
620 if (contentLength > 0) {
621 waitingForBodyMessage = true;
622 } else if (contentLength == 0) {
623 endOfStream = true;
624 return false;
625 }
626 }
627
628 // Request more data immediately
629 if (!waitingForBodyMessage) {
630 socketWrapper.write(true, getBodyMessageArray, 0, getBodyMessageArray.length);
631 socketWrapper.flush(true);
632 waitingForBodyMessage = true;
633 }
634
635 boolean moreData = receive(block);
636 if (!moreData && !waitingForBodyMessage) {
637 endOfStream = true;
638 }
639 return moreData;
640 }
641
642
643 /**

Callers 3

finishResponseMethod · 0.95
availableMethod · 0.95
doReadMethod · 0.80

Calls 4

receiveMethod · 0.95
getContentLengthLongMethod · 0.65
writeMethod · 0.65
flushMethod · 0.65

Tested by

no test coverage detected