Commit 6c344804 authored by Ramin Halavati's avatar Ramin Halavati Committed by Commit Bot

Add traffic annotation to HttpServer::HandleReadRequest().

Network traffic annotation is added to the handle read request of
HttpServer.

Bug: 656607
Change-Id: Ideecf50bcbb740efcb0a75b449c042d9c17e16e4
Reviewed-on: https://chromium-review.googlesource.com/910888
Commit-Queue: Ramin Halavati <rhalavati@chromium.org>
Reviewed-by: default avatarMatt Menke <mmenke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#536674}
parent da7e0fe3
...@@ -27,6 +27,31 @@ ...@@ -27,6 +27,31 @@
namespace net { namespace net {
namespace {
constexpr NetworkTrafficAnnotationTag
kHttpServerErrorResponseTrafficAnnotation =
DefineNetworkTrafficAnnotation("http_server_error_response",
R"(
semantics {
sender: "HTTP Server"
description: "Error response from the built-in HTTP server."
trigger: "Sending a request to the HTTP server that it can't handle."
data: "A 500 error code."
destination: OTHER
destination_other: "Any destination the consumer selects."
}
policy {
cookies_allowed: NO
setting:
"This request cannot be disabled in settings. However it will never "
"be made unless user activates an HTTP server."
policy_exception_justification:
"Not implemented, not used if HTTP Server is not activated."
})");
} // namespace
HttpServer::HttpServer(std::unique_ptr<ServerSocket> server_socket, HttpServer::HttpServer(std::unique_ptr<ServerSocket> server_socket,
HttpServer::Delegate* delegate) HttpServer::Delegate* delegate)
: server_socket_(std::move(server_socket)), : server_socket_(std::move(server_socket)),
...@@ -271,12 +296,11 @@ int HttpServer::HandleReadResult(HttpConnection* connection, int rv) { ...@@ -271,12 +296,11 @@ int HttpServer::HandleReadResult(HttpConnection* connection, int rv) {
if (!base::StringToSizeT(request.GetHeaderValue(kContentLength), if (!base::StringToSizeT(request.GetHeaderValue(kContentLength),
&content_length) || &content_length) ||
content_length > kMaxBodySize) { content_length > kMaxBodySize) {
// TODO (https://crbug.com/656607): Add proper annotation.
SendResponse(connection->id(), SendResponse(connection->id(),
HttpServerResponseInfo::CreateFor500( HttpServerResponseInfo::CreateFor500(
"request content-length too big or unknown: " + "request content-length too big or unknown: " +
request.GetHeaderValue(kContentLength)), request.GetHeaderValue(kContentLength)),
NO_TRAFFIC_ANNOTATION_BUG_656607); kHttpServerErrorResponseTrafficAnnotation);
Close(connection->id()); Close(connection->id());
return ERR_CONNECTION_CLOSED; return ERR_CONNECTION_CLOSED;
} }
......
...@@ -43686,6 +43686,7 @@ Called by update_traffic_annotation_histograms.py.--> ...@@ -43686,6 +43686,7 @@ Called by update_traffic_annotation_histograms.py.-->
<int value="29865866" label="headless_url_request"/> <int value="29865866" label="headless_url_request"/>
<int value="30913825" label="family_info"/> <int value="30913825" label="family_info"/>
<int value="32030464" label="persist_blob_to_indexed_db"/> <int value="32030464" label="persist_blob_to_indexed_db"/>
<int value="32197336" label="http_server_error_response"/>
<int value="32585152" label="gaia_oauth_client_get_token_info"/> <int value="32585152" label="gaia_oauth_client_get_token_info"/>
<int value="35370363" label="suggestions_service"/> <int value="35370363" label="suggestions_service"/>
<int value="35380758" label="download_manager_resume"/> <int value="35380758" label="download_manager_resume"/>
...@@ -116,6 +116,7 @@ Refer to README.md for content description and update process. ...@@ -116,6 +116,7 @@ Refer to README.md for content description and update process.
<item id="headless_url_request" hash_code="29865866" type="0" content_hash_code="76700151" os_list="linux,windows" file_path="headless/public/util/http_url_fetcher.cc"/> <item id="headless_url_request" hash_code="29865866" type="0" content_hash_code="76700151" os_list="linux,windows" file_path="headless/public/util/http_url_fetcher.cc"/>
<item id="history_notice_utils_notice" hash_code="102595701" type="1" second_id="110307337" content_hash_code="130829410" os_list="linux,windows" semantics_fields="2,3,4" policy_fields="4" file_path="components/browsing_data/core/history_notice_utils.cc"/> <item id="history_notice_utils_notice" hash_code="102595701" type="1" second_id="110307337" content_hash_code="130829410" os_list="linux,windows" semantics_fields="2,3,4" policy_fields="4" file_path="components/browsing_data/core/history_notice_utils.cc"/>
<item id="history_notice_utils_popup" hash_code="80832574" type="1" second_id="110307337" content_hash_code="30618510" os_list="linux,windows" semantics_fields="2,3,4" policy_fields="4" file_path="components/browsing_data/core/history_notice_utils.cc"/> <item id="history_notice_utils_popup" hash_code="80832574" type="1" second_id="110307337" content_hash_code="30618510" os_list="linux,windows" semantics_fields="2,3,4" policy_fields="4" file_path="components/browsing_data/core/history_notice_utils.cc"/>
<item id="http_server_error_response" hash_code="32197336" type="0" content_hash_code="61082230" os_list="linux,windows" file_path="net/server/http_server.cc"/>
<item id="icon_cacher" hash_code="103133150" type="0" content_hash_code="116368348" os_list="linux,windows" file_path="components/ntp_tiles/icon_cacher_impl.cc"/> <item id="icon_cacher" hash_code="103133150" type="0" content_hash_code="116368348" os_list="linux,windows" file_path="components/ntp_tiles/icon_cacher_impl.cc"/>
<item id="icon_catcher_get_large_icon" hash_code="44494884" type="0" content_hash_code="98262037" os_list="linux,windows" file_path="components/ntp_tiles/icon_cacher_impl.cc"/> <item id="icon_catcher_get_large_icon" hash_code="44494884" type="0" content_hash_code="98262037" os_list="linux,windows" file_path="components/ntp_tiles/icon_cacher_impl.cc"/>
<item id="indexed_db_internals_handler" hash_code="131180348" type="0" content_hash_code="59026406" os_list="linux,windows" file_path="content/browser/indexed_db/indexed_db_internals_ui.cc"/> <item id="indexed_db_internals_handler" hash_code="131180348" type="0" content_hash_code="59026406" os_list="linux,windows" file_path="content/browser/indexed_db/indexed_db_internals_ui.cc"/>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment