-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Issue #6973 - Setup Request/Response objects for success with RequestLog #7183
Changes from 2 commits
b934fed
5ff321a
a1daaae
429a4d9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1413,6 +1413,20 @@ public String changeSessionId() | |
return session.getId(); | ||
} | ||
|
||
protected void onRequestLog() | ||
{ | ||
// Don't allow pulling more parameters | ||
_contentParamsExtracted = true; | ||
|
||
// Reset the status code to what was committed | ||
MetaData.Response committedResponse = getResponse().getCommittedMetaData(); | ||
if (committedResponse != null) | ||
{ | ||
getResponse().setStatus(committedResponse.getStatus()); | ||
// TODO: Reset the response headers to what they were when committed | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's leave all the restoring of state to a different PR, as it is a different issue There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm only restoring response status code, which needs to happen for BadMessage during HttpParser. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The part 2 PR is much more comprehensive, this is the minimum in my view. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm thinking we can achieve PR2 with a change to the |
||
} | ||
|
||
/** | ||
* Called when the request is fully finished being handled. | ||
* For every session in any context that the session has | ||
|
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.
Could we not just move the call to
_request.onCompleted()
to before this line and then avoid creating another event and callback to the request?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.
I believe
onCompleted()
is too late, by that point the request / response has been recycled already.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.
We also don't want all of the unnecessary steps (like the restoring) to occur if there's no RequestLog declared / active.
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.
@joakime I believe that we can move the call to
onCompleted
to be just before the request log steps. I think it is at least worth a try. It makes sense to not log the request until it's handling is completed.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.
Moving the fixing of Request to Request.onComplete() didn't work for the logback test suite.
Moving the fixing of the Request (contentParamsExtracted and status) to Request.onCompleted() breaks logging for session information (they get auth[nz] details out from sessions), and multipart information (file sizes), etc.
Currently, with the PR like it sits here, the RequestLog.log() occurs during HttpChannel.onComplete(), and before Channel idle timeout reset, and Request.onCompleted().
Turns out this location is the perfect place for RequestLog.log() to make sense.
We need another event before Request.onComplete() to fixate the Request/Response.
Or move the exiting behaviors in Request.onComplete() to a new event like Request.recycle() so we can use Request.onComplete() for RequestLog behaviors.
The two events with a RequestLog.log() in between is still needed.
Stated in a different way.
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.
I have a potential solution.
At least one that logback tests seem happy with.