mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-28 21:54:40 +03:00
WebServer: Put dbgln's behind WEBSERVER_DEBUG
These dbgln's caused excessive load in the WebServer process, accounting for ~67% of the processing time when serving a webpage with a bunch of resources like serenityos.org/happy/2nd/.
This commit is contained in:
parent
a557f83f8c
commit
e68780e1ad
Notes:
sideshowbarker
2024-07-18 17:09:40 +09:00
Author: https://github.com/EdwinHoksberg Commit: https://github.com/SerenityOS/serenity/commit/e68780e1ad8 Pull-request: https://github.com/SerenityOS/serenity/pull/7594 Reviewed-by: https://github.com/linusg
@ -422,6 +422,10 @@
|
||||
#cmakedefine01 WASM_TRACE_DEBUG
|
||||
#endif
|
||||
|
||||
#ifndef WEBSERVER_DEBUG
|
||||
#cmakedefine01 WEBSERVER_DEBUG
|
||||
#endif
|
||||
|
||||
#ifndef WINDOWMANAGER_DEBUG
|
||||
#cmakedefine01 WINDOWMANAGER_DEBUG
|
||||
#endif
|
||||
|
@ -186,6 +186,7 @@ set(WASM_TRACE_DEBUG ON)
|
||||
set(PDF_DEBUG ON)
|
||||
set(SOLITAIRE_DEBUG ON)
|
||||
set(DDS_DEBUG ON)
|
||||
set(WEBSERVER_DEBUG ON)
|
||||
|
||||
# False positive: DEBUG is a flag but it works differently.
|
||||
# set(DEBUG ON)
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "Client.h"
|
||||
#include <AK/Base64.h>
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/MappedFile.h>
|
||||
#include <AK/MemoryStream.h>
|
||||
@ -50,7 +51,7 @@ void Client::start()
|
||||
}
|
||||
|
||||
auto request = builder.to_byte_buffer();
|
||||
dbgln("Got raw request: '{}'", String::copy(request));
|
||||
dbgln_if(WEBSERVER_DEBUG, "Got raw request: '{}'", String::copy(request));
|
||||
handle_request(request);
|
||||
die();
|
||||
};
|
||||
@ -63,9 +64,11 @@ void Client::handle_request(ReadonlyBytes raw_request)
|
||||
return;
|
||||
auto& request = request_or_error.value();
|
||||
|
||||
dbgln("Got HTTP request: {} {}", request.method_name(), request.resource());
|
||||
for (auto& header : request.headers()) {
|
||||
dbgln(" {} => {}", header.name, header.value);
|
||||
if constexpr (WEBSERVER_DEBUG) {
|
||||
dbgln("Got HTTP request: {} {}", request.method_name(), request.resource());
|
||||
for (auto& header : request.headers()) {
|
||||
dbgln(" {} => {}", header.name, header.value);
|
||||
}
|
||||
}
|
||||
|
||||
if (request.method() != HTTP::HttpRequest::Method::GET) {
|
||||
@ -74,7 +77,7 @@ void Client::handle_request(ReadonlyBytes raw_request)
|
||||
}
|
||||
|
||||
auto requested_path = LexicalPath::join("/", request.resource()).string();
|
||||
dbgln("Canonical requested path: '{}'", requested_path);
|
||||
dbgln_if(WEBSERVER_DEBUG, "Canonical requested path: '{}'", requested_path);
|
||||
|
||||
StringBuilder path_builder;
|
||||
path_builder.append(m_root_path);
|
||||
|
Loading…
Reference in New Issue
Block a user