Skip to content

Commit

Permalink
Beginning of more modern Webserver Request
Browse files Browse the repository at this point in the history
  • Loading branch information
teusbenschop committed Dec 28, 2023
1 parent c551dca commit e9d30e5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
8 changes: 4 additions & 4 deletions bootstrap/bootstrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,14 @@ bool browser_request_security_okay (Webserver_Request * request)
// This function is the first function to be called after a client requests a page or file.
// Based on the request from the client,
// it decides which functions to call to obtain the response.
void bootstrap_index (void * webserver_request)
void bootstrap_index (Webserver_Request& webserver_request)
{
Webserver_Request * request = std::addressof(webserver_request);

shared_ptr<Developer_Logic_Tracer> developer_logic_tracer = nullptr;
if (config_globals_log_network) {
developer_logic_tracer = make_shared<Developer_Logic_Tracer>(webserver_request);
developer_logic_tracer = make_shared<Developer_Logic_Tracer>(request);
}

Webserver_Request * request = static_cast<Webserver_Request *>(webserver_request);

// Record the POST request made to the web server.
// This can be used for debugging.
Expand Down
4 changes: 3 additions & 1 deletion bootstrap/bootstrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include <config/libraries.h>

void bootstrap_index (void * webserver_request);
class Webserver_Request;

void bootstrap_index (Webserver_Request& webserver_request);
4 changes: 2 additions & 2 deletions webserver/webserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ void webserver_process_request (const int connfd, const string& clientaddress)
http_parse_post (postdata, &request);

// Assemble response.
bootstrap_index (&request);
bootstrap_index (request);
http_assemble_response (&request);

// Send response to browser.
Expand Down Expand Up @@ -615,7 +615,7 @@ void secure_webserver_process_request (mbedtls_ssl_config * conf, mbedtls_net_co

// Assemble response.
if (connection_healthy) {
bootstrap_index (&request);
bootstrap_index (request);
http_assemble_response (&request);
}

Expand Down

0 comments on commit e9d30e5

Please sign in to comment.