-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Tunnel Server RESPONSE dumps #279
base: master
Are you sure you want to change the base?
Improve Tunnel Server RESPONSE dumps #279
Conversation
"Tunnel Server RESPONSE" debugs() in Http::Tunneler::handleResponse() incorrectly assumed that readBuf contained hdr_sz bytes, but in reality it contains no header bytes and usually is empty. To avoid such problems we must pair rawContent() with the SBuf's length().
Adjusted Http::Tunneler::handleResponse() in line with a similar HttpStateData::processReplyHeader().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for fixing this. I think we must disclose the known problems associated with this duplicated code. I adjusted PR description accordingly and posted a suggestion. I also reduce PR title claim from "fix" to "improve" because this change can be viewed as a partial fix, and I do not want to overpromise and underdeliver.
@@ -296,15 +296,23 @@ Http::Tunneler::handleResponse(const bool eof) | |||
} | |||
|
|||
if (!parsedOk) { | |||
debugs(11, 3, "Non-HTTP-compliant header:\n---------\n" << readBuf << "\n----------"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code suffers from the same two problems that equivalent HttpStateData::processReplyHeader() code suffers from. We can propose to duplicate those problems (for now), but (if we do) we should be explicit about it (so that it does not look as if we are unknowingly adding bugs):
debugs(11, 3, "Non-HTTP-compliant header:\n---------\n" << readBuf << "\n----------"); | |
// XXX: This code and Server RESPONSE reporting code below duplicate | |
// HttpStateData::processReplyHeader() reporting code, including its problems. | |
debugs(11, 3, "Non-HTTP-compliant header:\n---------\n" << readBuf << "\n----------"); |
The above suggestion also documents code duplication itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
…cache#1977) To avoid documentation duplication, current https_port and ftp_port directive descriptions reference http_port directive instead of detailing their own supported parameters. For https_port, this solution creates a false impression that the directive supports all http_port options. Our ftp_port documentation is better but still leaves the reader guessing which options are actually supported. This change starts enumerating http_port configuration parameters that ftp_port and https_port directives do _not_ support. Eventually, Squid should reject configurations with unsupported listening port options.
Level-2 "Tunnel Server RESPONSE:..." debugs() incorrectly assumed that
its readBuf parameter contained hdr_sz header bytes. In reality, by the
time code reached that debugs(), readBuf no longer had any header bytes
(and often had no bytes at all). Besides broken header dumps, this bug
could lead to problems that Valgrind reports as "Conditional jump or
move depends on uninitialised value" in DebugChannel::writeToStream().
This fix mimics HttpStateData::processReplyHeader() reporting code,
including its known problems. Future changes should address those
problems and reduce code duplication across at least ten functions
containing similar "decorated" level-2 message dumps.