Skip to content

Commit

Permalink
Fixed based on feedback (#260)
Browse files Browse the repository at this point in the history
Signed-off-by: gargnupur <gargnupur@google.com>
  • Loading branch information
gargnupur authored Aug 17, 2020
1 parent e31a9ae commit c82318d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions source/extensions/common/wasm/context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1301,9 +1301,14 @@ void Context::log(const Http::RequestHeaderMap* request_headers,
const Http::ResponseHeaderMap* response_headers,
const Http::ResponseTrailerMap* response_trailers,
const StreamInfo::StreamInfo& stream_info) {
if (!http_request_started_) {
return;
if (!in_vm_context_created_) {
// If the request is invalid then onRequestHeaders() will not be called and neither will
// onCreate() in cases like sendLocalReply who short-circuits envoy
// lifecycle. This is because Envoy does not have a well defined lifetime for the combined HTTP
// + AccessLog filter. Thus, to log these scenarios, we call onCreate() in log function below.
onCreate();
}

access_log_request_headers_ = request_headers;
// ? request_trailers ?
access_log_response_headers_ = response_headers;
Expand Down

0 comments on commit c82318d

Please sign in to comment.