Skip to content

Commit f60be75

Browse files
Charles Chiufacebook-github-bot
Charles Chiu
authored andcommitted
Print malformed header values in hex
Summary: Add a debug log to print malformed header values in hex, it's helpful to identify control characters like \n, \r, etc. Reviewed By: hanidamlaj Differential Revision: D75159644 fbshipit-source-id: a544b7145d774f7f61e41aad06d9188214c1a21f
1 parent 86b430b commit f60be75

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

proxygen/lib/http/codec/HTTP1xCodec.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,9 @@ bool HTTP1xCodec::pushHeaderNameAndValue(HTTPHeaders& hdrs) {
910910
validationError_ = kErrorHeaderContentValidation;
911911
LOG(ERROR) << "Invalid header name=" << headerName;
912912
DVLOG(4) << " value=" << currentHeaderValue_;
913+
// Hexlify the value for debuggability in case it contains non-printable
914+
// characters like \n, \t, etc.
915+
DVLOG(4) << " value in hex=" << folly::hexlify(currentHeaderValue_);
913916
return false;
914917
}
915918
}

0 commit comments

Comments
 (0)