-
Notifications
You must be signed in to change notification settings - Fork 504
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
Refactor and improve ErrorState::Dump #1730
Conversation
Run-tested. Output: ?subject=CacheErrorInfo%20-%20ERR_ACCESS_DENIED**&**body=CacheHost%3A%20n2%0D%0AErrPage%3A%20ERR_ACCESS_DENIED%0D%0AErr%3A%20%5Bnone%5D%0D%0ATimeStamp%3A%20Sat%2C%2009%20Mar%202024%2014%3A48%3A00%20GMT%0D%0AClientIP%3A%20127.0.0.1%3A53002%0D%0A%0D%0AHTTP%20Request%3A%0D%0AGET%20%2Fbar%20HTTP%2F1.1%0D%0AHost%3A%20www.fb.com%0D%0AUser-Agent%3A%20curl%2F7.81.0%0D%0AAccept%3A%20%2A%2F%2A%0D%0AProxy-Connection%3A%20Keep-Alive%0D%0A%0D%0A%0D%0A In bold is a bug (& should be &). |
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.
Run-tested. Output: [
%W
value]
Please post two %W
values: one before and one after these changes. Do not use text formatting. Do use diff quoting format to improve readability:
```diff
- before
+ after
`` `
If you do it right, you will see GitHub rendering your diff as a diff in Preview, like here:
- before
+ after
(& should be &). That bug is not new, master has the same faulty behaviour
Are you preserving the old bug because it is difficult to fix or for some other reason? If it is difficult to fix, can you mark the buggy code with an XXX C++ comment?
This comment was marked as resolved.
This comment was marked as resolved.
IIRC this string is being generated for a |
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.
LGTM, just Alex review items to resolve.
Yes; it's mostly a note to self, I haven't had the time to investigate where that url-encoding is taking place |
src/errorpage.cc
Outdated
/* - TimeStamp */ | ||
str.appendf("TimeStamp: %s\r\n\r\n", Time::FormatRfc1123(squid_curtime)); | ||
body << "TimeStamp: " << Time::FormatRfc1123(squid_curtime) << "\r\n\r\n" | ||
"ClientIP: " << src_addr << "\r\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 new/PR code is implicitly using Ip::Address::toUrl(). Official code uses Ip::Address::toStr(). The two methods produce different output. If this change is desirable, please disclose it (with its rationale and effect) in the PR description. Otherwise, refactor to avoid an undesirable change.
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.
Thanks for picking this up; reverted to the previous output
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 change is still present. Only change was the line it occurs on - which confuses github into marking it "outdated".
LegacyInputIterator operator "*" is supposed to return reference, not value_type.
Thank you for addressing my change requests.
…to refactor-errorstate-dump
Rework the internals for generating output in ErrorState::Dump, used for expanding the '%W' token in error page templates. Also fix a bug with excessive html-quoting of the output.
Rework the internals for generating output in ErrorState::Dump, used for expanding the '%W' token in error page templates. Also fix a bug with excessive html-quoting of the output.
Rework the internals for generating output in ErrorState::Dump, used for expanding the '%W' token in error page templates. Also fix a bug with excessive html-quoting of the output.
Rework the internals for generating output in ErrorState::Dump, used for expanding the '%W' token in error page templates. Also fix a bug with excessive html-quoting of the output.
Rework the internals for generating output in ErrorState::Dump,
used for expanding the '%W' token in error page templates.
Also fix a bug with excessive html-quoting of the output.