Skip to content

Commit

Permalink
Fix mixer client crash. (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
qiwzhang authored Mar 1, 2017
1 parent 0c7c549 commit fc9497a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/envoy/mixer/http_control.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,12 @@ void FillRequestHeaderAttributes(const HeaderMap& header_map,
StringMapValue(ExtractHeaders(header_map));
}

void FillResponseHeaderAttributes(const HeaderMap& header_map,
void FillResponseHeaderAttributes(const HeaderMap* header_map,
Attributes* attr) {
attr->attributes[kResponseHeaders] =
StringMapValue(ExtractHeaders(header_map));
if (header_map) {
attr->attributes[kResponseHeaders] =
StringMapValue(ExtractHeaders(*header_map));
}
attr->attributes[kResponseTime] = TimeValue(std::chrono::system_clock::now());
}

Expand Down Expand Up @@ -180,7 +182,7 @@ void HttpControl::Report(HttpRequestDataPtr request_data,
int check_status, DoneFunc on_done) {
// Use all Check attributes for Report.
// Add additional Report attributes.
FillResponseHeaderAttributes(*response_headers, &request_data->attributes);
FillResponseHeaderAttributes(response_headers, &request_data->attributes);

FillRequestInfoAttributes(request_info, check_status,
&request_data->attributes);
Expand Down

0 comments on commit fc9497a

Please sign in to comment.