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

Method checkSpecialHeader

java/org/apache/coyote/Response.java:522–542  ·  view source on GitHub ↗

Set internal fields for special header names. Called from set/addHeader. Return true if the header is special, no need to set the header.

(String name, String value)

Source from the content-addressed store, hash-verified

520 * need to set the header.
521 */
522 private boolean checkSpecialHeader(String name, String value) {
523 if (name.equalsIgnoreCase("Content-Type")) {
524 setContentType(value);
525 return true;
526 }
527 if (name.equalsIgnoreCase("Content-Length")) {
528 try {
529 if (value == null) {
530 setContentLength(-1);
531 return true;
532 }
533 long cL = Long.parseLong(value);
534 setContentLength(cL);
535 } catch (NumberFormatException ex) {
536 setContentLength(-1);
537 log.warn(sm.getString("response.contentlength.invalid", value), ex);
538 }
539 return true;
540 }
541 return false;
542 }
543
544
545 /**

Callers 2

setHeaderMethod · 0.95
addHeaderMethod · 0.95

Calls 6

setContentTypeMethod · 0.95
setContentLengthMethod · 0.95
warnMethod · 0.65
getStringMethod · 0.65
equalsIgnoreCaseMethod · 0.45
parseLongMethod · 0.45

Tested by

no test coverage detected