private HttpContent buildBrokenHttpContent(final Throwable t) { stream.getInputHttpHeader().setExpectContent(false); return HttpBrokenContent.builder(stream.getInputHttpHeader()) .error(t) .build(); }
private HttpContent buildBrokenHttpContent(final Throwable t) { stream.getInputHttpHeader().setExpectContent(false); return HttpBrokenContent.builder(stream.getInputHttpHeader()) .error(t) .build(); }
private HttpContent buildBrokenHttpContent(final Throwable t) { stream.getInputHttpHeader().setExpectContent(false); return HttpBrokenContent.builder(stream.getInputHttpHeader()) .error(t) .build(); }
private HttpContent buildBrokenHttpContent(final Throwable t) { stream.getInputHttpHeader().setExpectContent(false); return HttpBrokenContent.builder(stream.getInputHttpHeader()) .error(t) .build(); }
private HttpContent buildBrokenHttpContent(final Throwable t) { stream.getInputHttpHeader().setExpectContent(false); return HttpBrokenContent.builder(stream.getInputHttpHeader()) .error(t) .build(); }
private HttpContent buildBrokenHttpContent(final Throwable t) { stream.getInputHttpHeader().setExpectContent(false); return HttpBrokenContent.builder(stream.getInputHttpHeader()) .error(t) .build(); }
private HttpContent buildBrokenHttpContent(final Throwable t) { stream.getInputHttpHeader().setExpectContent(false); return HttpBrokenContent.builder(stream.getInputHttpHeader()) .error(t) .build(); }
private HttpContent buildBrokenHttpContent(final Throwable t) { stream.getInputHttpHeader().setExpectContent(false); return HttpBrokenContent.builder(stream.getInputHttpHeader()) .error(t) .build(); }
private HttpContent buildBrokenHttpContent(final Throwable t) { stream.getInputHttpHeader().setExpectContent(false); return HttpBrokenContent.builder(stream.getInputHttpHeader()) .error(t) .build(); }
/** * Based on content-length header (which we may have or may not), double * check if the payload we've just got is last. * * @param newDataChunkSize the number of bytes we've just got. * @return <tt>true</tt> if we don't expect more content, or <tt>false</tt> if * we do expect more content or we're not sure because content-length header * was not specified by peer. */ private boolean checkContentLength(final int newDataChunkSize) { if (remainingContentLength == NULL_CONTENT_LENGTH) { remainingContentLength = stream.getInputHttpHeader().getContentLength(); } if (remainingContentLength >= 0) { remainingContentLength -= newDataChunkSize; if (remainingContentLength == 0) { return true; } else if (remainingContentLength < 0) { // Peer sent more bytes than specified in the content-length throw new IllegalStateException("Http2Stream #" + stream.getId() + ": peer is sending data beyond specified content-length limit"); } } return false; }
/** * Based on content-length header (which we may have or may not), double * check if the payload we've just got is last. * * @param newDataChunkSize the number of bytes we've just got. * @return <tt>true</tt> if we don't expect more content, or <tt>false</tt> if * we do expect more content or we're not sure because content-length header * was not specified by peer. */ private boolean checkContentLength(final int newDataChunkSize) { if (remainingContentLength == NULL_CONTENT_LENGTH) { remainingContentLength = stream.getInputHttpHeader().getContentLength(); } if (remainingContentLength >= 0) { remainingContentLength -= newDataChunkSize; if (remainingContentLength == 0) { return true; } else if (remainingContentLength < 0) { // Peer sent more bytes than specified in the content-length throw new IllegalStateException("Http2Stream #" + stream.getId() + ": peer is sending data beyond specified content-length limit"); } } return false; }
/** * Based on content-length header (which we may have or may not), double * check if the payload we've just got is last. * * @param newDataChunkSize the number of bytes we've just got. * @return <tt>true</tt> if we don't expect more content, or <tt>false</tt> if * we do expect more content or we're not sure because content-length header * was not specified by peer. */ private boolean checkContentLength(final int newDataChunkSize) { if (remainingContentLength == NULL_CONTENT_LENGTH) { remainingContentLength = stream.getInputHttpHeader().getContentLength(); } if (remainingContentLength >= 0) { remainingContentLength -= newDataChunkSize; if (remainingContentLength == 0) { return true; } else if (remainingContentLength < 0) { // Peer sent more bytes than specified in the content-length throw new IllegalStateException("Http2Stream #" + stream.getId() + ": peer is sending data beyond specified content-length limit"); } } return false; }
/** * Based on content-length header (which we may have or may not), double * check if the payload we've just got is last. * * @param newDataChunkSize the number of bytes we've just got. * @return <tt>true</tt> if we don't expect more content, or <tt>false</tt> if * we do expect more content or we're not sure because content-length header * was not specified by peer. */ private boolean checkContentLength(final int newDataChunkSize) { if (remainingContentLength == NULL_CONTENT_LENGTH) { remainingContentLength = stream.getInputHttpHeader().getContentLength(); } if (remainingContentLength >= 0) { remainingContentLength -= newDataChunkSize; if (remainingContentLength == 0) { return true; } else if (remainingContentLength < 0) { // Peer sent more bytes than specified in the content-length throw new IllegalStateException("Http2Stream #" + stream.getId() + ": peer is sending data beyond specified content-length limit"); } } return false; }
/** * Based on content-length header (which we may have or may not), double * check if the payload we've just got is last. * * @param newDataChunkSize the number of bytes we've just got. * @return <tt>true</tt> if we don't expect more content, or <tt>false</tt> if * we do expect more content or we're not sure because content-length header * was not specified by peer. */ private boolean checkContentLength(final int newDataChunkSize) { if (remainingContentLength == NULL_CONTENT_LENGTH) { remainingContentLength = stream.getInputHttpHeader().getContentLength(); } if (remainingContentLength >= 0) { remainingContentLength -= newDataChunkSize; if (remainingContentLength == 0) { return true; } else if (remainingContentLength < 0) { // Peer sent more bytes than specified in the content-length throw new IllegalStateException("Http2Stream #" + stream.getId() + ": peer is sending data beyond specified content-length limit"); } } return false; }
/** * Builds {@link HttpContent} based on passed payload {@link Buffer}. * If the payload size is <tt>0</tt> and the input buffer has been terminated - * return {@link HttpBrokenContent}. */ private HttpContent buildHttpContent(final Buffer payload) { final Termination localTermination = closeFlag; final boolean isFin = localTermination == IN_FIN_TERMINATION; final HttpContent httpContent; // if payload size is not 0 or this is FIN payload if (payload.hasRemaining() || localTermination == null || isFin) { final HttpHeader inputHttpHeader = stream.getInputHttpHeader(); inputHttpHeader.setExpectContent(!isFin); httpContent = HttpContent.builder(inputHttpHeader) .content(payload) .last(isFin) .build(); } else { // create broken HttpContent httpContent = buildBrokenHttpContent( new EOFException(localTermination.getDescription())); } return httpContent; }
/** * Builds {@link HttpContent} based on passed payload {@link Buffer}. * If the payload size is <tt>0</tt> and the input buffer has been terminated - * return {@link HttpBrokenContent}. */ private HttpContent buildHttpContent(final Buffer payload) { final Termination localTermination = closeFlag; final boolean isFin = localTermination == IN_FIN_TERMINATION; final HttpContent httpContent; // if payload size is not 0 or this is FIN payload if (payload.hasRemaining() || localTermination == null || isFin) { final HttpHeader inputHttpHeader = stream.getInputHttpHeader(); inputHttpHeader.setExpectContent(!isFin); httpContent = HttpContent.builder(inputHttpHeader) .content(payload) .last(isFin) .build(); } else { // create broken HttpContent httpContent = buildBrokenHttpContent( new EOFException(localTermination.getDescription())); } return httpContent; }
/** * Builds {@link HttpContent} based on passed payload {@link Buffer}. * If the payload size is <tt>0</tt> and the input buffer has been terminated - * return {@link HttpBrokenContent}. */ private HttpContent buildHttpContent(final Buffer payload) { final Termination localTermination = closeFlag; final boolean isFin = localTermination == IN_FIN_TERMINATION; final HttpContent httpContent; // if payload size is not 0 or this is FIN payload if (payload.hasRemaining() || localTermination == null || isFin) { final HttpHeader inputHttpHeader = stream.getInputHttpHeader(); inputHttpHeader.setExpectContent(!isFin); httpContent = HttpContent.builder(inputHttpHeader) .content(payload) .last(isFin) .build(); } else { // create broken HttpContent httpContent = buildBrokenHttpContent( new EOFException(localTermination.getDescription())); } return httpContent; }
/** * Builds {@link HttpContent} based on passed payload {@link Buffer}. * If the payload size is <tt>0</tt> and the input buffer has been terminated - * return {@link HttpBrokenContent}. */ private HttpContent buildHttpContent(final Buffer payload) { final Termination localTermination = closeFlag; final boolean isFin = localTermination == IN_FIN_TERMINATION; final HttpContent httpContent; // if payload size is not 0 or this is FIN payload if (payload.hasRemaining() || localTermination == null || isFin) { final HttpHeader inputHttpHeader = stream.getInputHttpHeader(); inputHttpHeader.setExpectContent(!isFin); httpContent = HttpContent.builder(inputHttpHeader) .content(payload) .last(isFin) .build(); } else { // create broken HttpContent httpContent = buildBrokenHttpContent( new EOFException(localTermination.getDescription())); } return httpContent; }
/** * Builds {@link HttpContent} based on passed payload {@link Buffer}. * If the payload size is <tt>0</tt> and the input buffer has been terminated - * return {@link HttpBrokenContent}. */ private HttpContent buildHttpContent(final Buffer payload) { final Termination localTermination = closeFlag; final boolean isFin = localTermination == IN_FIN_TERMINATION; final HttpContent httpContent; // if payload size is not 0 or this is FIN payload if (payload.hasRemaining() || localTermination == null || isFin) { final HttpHeader inputHttpHeader = stream.getInputHttpHeader(); inputHttpHeader.setExpectContent(!isFin); httpContent = HttpContent.builder(inputHttpHeader) .content(payload) .last(isFin) .build(); } else { // create broken HttpContent httpContent = buildBrokenHttpContent( new EOFException(localTermination.getDescription())); } return httpContent; }
/** * Builds {@link HttpContent} based on passed payload {@link Buffer}. * If the payload size is <tt>0</tt> and the input buffer has been terminated - * return {@link HttpBrokenContent}. */ private HttpContent buildHttpContent(final Buffer payload) { final Termination localTermination = closeFlag; final boolean isFin = localTermination == IN_FIN_TERMINATION; final HttpContent httpContent; // if payload size is not 0 or this is FIN payload if (payload.hasRemaining() || localTermination == null || isFin) { final HttpHeader inputHttpHeader = stream.getInputHttpHeader(); inputHttpHeader.setExpectContent(!isFin); httpContent = HttpContent.builder(inputHttpHeader) .content(payload) .last(isFin) .build(); } else { // create broken HttpContent httpContent = buildBrokenHttpContent( new EOFException(localTermination.getDescription())); } return httpContent; }