MCPcopy Index your code
hub / github.com/apache/tomcat / readChunkedPostBody

Method readChunkedPostBody

java/org/apache/catalina/connector/Request.java:3143–3172  ·  view source on GitHub ↗

Read chunked post body. @return the post body as a bytes array @throws IOException if an IO exception occurred

()

Source from the content-addressed store, hash-verified

3141 * @throws IOException if an IO exception occurred
3142 */
3143 protected byte[] readChunkedPostBody() throws IOException {
3144 ByteChunk body = new ByteChunk();
3145
3146 byte[] buffer = new byte[CACHED_POST_LEN];
3147
3148 int len = 0;
3149 while (len > -1) {
3150 len = getStream().read(buffer, 0, CACHED_POST_LEN);
3151 if (connector.getMaxPostSize() >= 0 && ((long) body.getLength() + len) > connector.getMaxPostSize()) {
3152 // Too much data
3153 checkSwallowInput();
3154 throw new InvalidParameterException(sm.getString("coyoteRequest.chunkedPostTooLarge"),
3155 HttpServletResponse.SC_REQUEST_ENTITY_TOO_LARGE);
3156 }
3157 if (len > 0) {
3158 body.append(buffer, 0, len);
3159 }
3160 }
3161 if (body.getLength() == 0) {
3162 return null;
3163 }
3164 if (body.getLength() < body.getBuffer().length) {
3165 int length = body.getLength();
3166 byte[] result = new byte[length];
3167 System.arraycopy(body.getBuffer(), 0, result, 0, length);
3168 return result;
3169 }
3170
3171 return body.getBuffer();
3172 }
3173
3174
3175 /**

Callers 1

doParseParametersMethod · 0.95

Calls 8

getStreamMethod · 0.95
checkSwallowInputMethod · 0.95
appendMethod · 0.95
getBufferMethod · 0.95
getMaxPostSizeMethod · 0.80
readMethod · 0.65
getLengthMethod · 0.65
getStringMethod · 0.65

Tested by

no test coverage detected