Index: chrome/test/webdriver/dispatch.cc |
=================================================================== |
--- chrome/test/webdriver/dispatch.cc (revision 79141) |
+++ chrome/test/webdriver/dispatch.cc (working copy) |
@@ -59,6 +59,15 @@ |
shutdown_event->Signal(); |
} |
+void SendNoContentResponse(struct mg_connection* connection, |
+ const struct mg_request_info* request_info, |
+ void* user_data) { |
+ std::string response = "HTTP/1.1 204 No Content\r\n" |
+ "Content-Length:0\r\n" |
+ "\r\n"; |
+ mg_write(connection, response.data(), response.length()); |
+} |
+ |
void SendNotImplementedError(struct mg_connection* connection, |
const struct mg_request_info* request_info, |
void* user_data) { |
@@ -245,7 +254,11 @@ |
} // namespace internal |
Dispatcher::Dispatcher(struct mg_context* context, const std::string& root) |
- : context_(context), root_(root) {} |
+ : context_(context), root_(root) { |
+ // Overwrite mongoose's default handler for /favicon.ico to always return a |
+ // 204 response so we don't spam the logs with 404s. |
+ mg_set_uri_callback(context_, "/favicon.ico", &SendNoContentResponse, NULL); |
+} |
Dispatcher::~Dispatcher() {} |