[Zrouter-src] ZRouter.org: push to zconf++ libzhttp/connection.cpp libzhttp/re...

zrouter-src at zrouter.org zrouter-src at zrouter.org
Mon Jan 9 17:18:37 UTC 2012


details:   /rev/a97993aa111b
changeset: 34:a97993aa111b
user:      "Nicolai Petri <nicolai at petri.dk>"
date:      Mon Jan 09 18:18:16 2012 +0100
description:
Initial version of quick and dirty http log output.
Limitations :
 - outputs to stdout
 - doesn't provide correct timestamp

diffstat:

 libzhttp/connection.cpp     |  3 +++
 libzhttp/request_parser.cpp |  1 -
 2 files changed, 3 insertions(+), 1 deletions(-)

diffs (24 lines):

diff -r a74ad84b8250 -r a97993aa111b libzhttp/connection.cpp
--- a/libzhttp/connection.cpp	Mon Jan 09 16:22:24 2012 +0100
+++ b/libzhttp/connection.cpp	Mon Jan 09 18:18:16 2012 +0100
@@ -56,6 +56,9 @@
     if (result)
     {
       request_handler_.handle_request(request_, reply_);
+      // FIXME: Make output of timestamp correct. (not hardcoded :)
+			std::cout << socket_.remote_endpoint().address() << " - - [99/Sep/2099:12:34:56 +0200] \"" << request_.method << " " << request_.uri << " " << "HTTP/" << request_.http_version_major << "." << request_.http_version_minor << "\" " << reply_.status << " " << reply_.content.size() << std::endl;
+
       boost::asio::async_write(socket_, reply_.to_buffers(),
           boost::bind(&connection::handle_write, shared_from_this(),
             boost::asio::placeholders::error));
diff -r a74ad84b8250 -r a97993aa111b libzhttp/request_parser.cpp
--- a/libzhttp/request_parser.cpp	Mon Jan 09 16:22:24 2012 +0100
+++ b/libzhttp/request_parser.cpp	Mon Jan 09 18:18:16 2012 +0100
@@ -295,7 +295,6 @@
 			return true;
     }
   case expecting_newline_3:
-		std::cout << "body start HTTP/" << req.http_version_major << "." << req.http_version_minor << " |" << req.method << "|"  << req.uri << "|" << req.headers.size() << "|" << std::endl;
     if (input == '\n') {
 			req.header_completed = true;
 			if (req.method == "POST" || req.method == "PUT") {


More information about the Zrouter-src mailing list