From ac9a53811e428940fcfad8bedb770e2503166264 Mon Sep 17 00:00:00 2001 From: Cedric RICARD Date: Sat, 10 Nov 2007 22:30:47 +0000 Subject: [PATCH] Adding profiling code and logs... Changing etag from sha1 to MD5 --- calexium_lib/web/CXM_multihost_http_server.anubis | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/calexium_lib/web/CXM_multihost_http_server.anubis b/calexium_lib/web/CXM_multihost_http_server.anubis index 1d874d0..f8f48e4 100644 --- a/calexium_lib/web/CXM_multihost_http_server.anubis +++ b/calexium_lib/web/CXM_multihost_http_server.anubis @@ -490,8 +490,25 @@ public define One --- That's all for the public part ! -------------------------------------------------- +define String + utime_to_string + ( + UTime t + ) = + integer_to_string(t.seconds) + "." + zero_pad_n(6, t.microseconds ) + "s". + - +variable UTime t0 = utime(0,0). +//variable Int32 t0_s = 0. +//variable Int32 t0_us = 0. + +define One + print_delta + ( + String txt + ) = +// with t0 = utime(t0_s, t0_us) + println(utime_to_string((UTime)now - *t0) + " : " + txt). @@ -2045,7 +2062,7 @@ define String if mb_ftimes is { failure then println("Warning: no file times for '" + filename + "', etag won't be very accurate."); to_ascii(sha1((filename, size))), - success(ftimes) then to_ascii(sha1((filename, ftimes, size))) + success(ftimes) then to_ascii(md5((filename, ftimes, size))) }. define Bool @@ -2935,7 +2952,6 @@ define Maybe((String,Web_Site_Description)) define One -> String make_generate_trust_ticket(DenialOfService dos). - define One http_https_handler ( @@ -2944,14 +2960,17 @@ define One Bool is_https, DenialOfService dos ) = + t0 <- (UTime)now; with start_time = (Int32)now, sttm <- start_time; + println("Request time: " + format_http_date(start_time)); if dos is denial_of_service(mc_v,rld_v,hd_v,ad_v,ld_v,ra_v) then if remote_IP_address_and_port(connection.conn) is (ip_addr,port) then if read_request_line(connection,start_time+*rld_v,dos) is { error(msg) then print(format(msg)), ok(request_line) then + print_delta("read_request_line"); if read_http_headers(connection,start_time+*hd_v,dos) is { error(msg) then print(format(msg)), @@ -2959,16 +2978,21 @@ define One { failure then unique, success(p) then if p is (host_name,desc) then + print_delta("get_site"); if get_body_size(headers) is { error(msg) then log_journal_msg(desc,format(msg)), ok(body_size) then + print_delta("get_body_size"); if read_http_body(connection,body_size,constant_byte_array(0,0),1000) is { error(msg) then log_journal_msg(desc,format(msg)), ok(body) then + print_delta("before send_answer"); send_answer(host_name, desc,connection.conn, request_line, headers, body, - make_generate_trust_ticket(dos)) + make_generate_trust_ticket(dos)); + with duration = (UTime) now - *t0, + println("Request duration: " + utime_to_string(duration)) } } } -- libgit2 0.21.4