Adding micros start to php-cgi env

This commit is contained in:
2020-12-05 12:40:02 +01:00
parent 941d669fcb
commit f148578154
3 changed files with 10 additions and 3 deletions

View File

@ -422,6 +422,7 @@ bool connection_handler(const char *preprefix, const char *col1, const char *col
" SERVER_SOFTWARE=" + cli_encode("Necronda 3.0") + " SERVER_SOFTWARE=" + cli_encode("Necronda 3.0") +
" SERVER_PROTOCOL=" + cli_encode("HTTP/1.1") + " SERVER_PROTOCOL=" + cli_encode("HTTP/1.1") +
" GATEWAY_INTERFACE=" + cli_encode("CGI/1.1") + " GATEWAY_INTERFACE=" + cli_encode("CGI/1.1") +
" REQUEST_TIMESTAMP=" + cli_encode(to_string(req.getMicrosStart())) +
" /usr/bin/php-cgi"; " /usr/bin/php-cgi";
pipes = procopen(cmd.c_str()); pipes = procopen(cmd.c_str());

View File

@ -164,10 +164,14 @@ string HttpConnection::getMethod() {
return request->getMethod(); return request->getMethod();
} }
long HttpConnection::getDuration() { unsigned long HttpConnection::getDuration() {
return getMicros() - microsStart; return getMicros() - microsStart;
} }
unsigned long HttpConnection::getMicrosStart() {
return microsStart;
}
HttpStatusCode HttpConnection::getStatusCode() { HttpStatusCode HttpConnection::getStatusCode() {
return response->getStatusCode(); return response->getStatusCode();
} }

View File

@ -14,7 +14,7 @@ private:
Socket *socket{}; Socket *socket{};
HttpRequest *request{}; HttpRequest *request{};
HttpResponse *response{}; HttpResponse *response{};
long microsStart{}; unsigned long microsStart{};
public: public:
explicit HttpConnection(); explicit HttpConnection();
@ -43,7 +43,9 @@ public:
void setField(string index, string data); void setField(string index, string data);
long getDuration(); unsigned long getDuration();
unsigned long getMicrosStart();
HttpStatusCode getStatusCode(); HttpStatusCode getStatusCode();