forked from lda/telodendria
Log once we get the response status, not right when we get the request.
This commit is contained in:
parent
fccd15b239
commit
9ec330f40a
4 changed files with 22 additions and 4 deletions
|
@ -233,6 +233,17 @@ HttpResponseStatus(HttpServerContext * c, HttpStatus status)
|
|||
c->responseStatus = status;
|
||||
}
|
||||
|
||||
HttpStatus
|
||||
HttpResponseStatusGet(HttpServerContext *c)
|
||||
{
|
||||
if (!c)
|
||||
{
|
||||
return HTTP_STATUS_UNKNOWN;
|
||||
}
|
||||
|
||||
return c->responseStatus;
|
||||
}
|
||||
|
||||
Stream *
|
||||
HttpServerStream(HttpServerContext * c)
|
||||
{
|
||||
|
|
10
src/Matrix.c
10
src/Matrix.c
|
@ -51,10 +51,6 @@ MatrixHttpHandler(HttpServerContext * context, void *argp)
|
|||
|
||||
requestPath = HttpRequestPath(context);
|
||||
|
||||
Log(LOG_INFO, "%s %s",
|
||||
HttpRequestMethodToString(HttpRequestMethodGet(context)),
|
||||
requestPath);
|
||||
|
||||
HttpResponseStatus(context, HTTP_OK);
|
||||
HttpResponseHeader(context, "Server", "Telodendria/" TELODENDRIA_VERSION);
|
||||
|
||||
|
@ -143,6 +139,12 @@ MatrixHttpHandler(HttpServerContext * context, void *argp)
|
|||
}
|
||||
|
||||
MATRIX_PATH_FREE(pathParts);
|
||||
|
||||
Log(LOG_INFO, "%s %s (%d %s)",
|
||||
HttpRequestMethodToString(HttpRequestMethodGet(context)),
|
||||
requestPath,
|
||||
HttpResponseStatusGet(context),
|
||||
HttpStatusToString(HttpResponseStatusGet(context)));
|
||||
}
|
||||
|
||||
HashMap *
|
||||
|
|
|
@ -48,6 +48,8 @@ typedef enum HttpRequestMethod
|
|||
|
||||
typedef enum HttpStatus
|
||||
{
|
||||
HTTP_STATUS_UNKNOWN = 0,
|
||||
|
||||
/* Informational responses */
|
||||
HTTP_CONTINUE = 100,
|
||||
HTTP_SWITCHING_PROTOCOLS = 101,
|
||||
|
|
|
@ -69,6 +69,9 @@ extern char *
|
|||
extern void
|
||||
HttpResponseStatus(HttpServerContext *, HttpStatus);
|
||||
|
||||
extern HttpStatus
|
||||
HttpResponseStatusGet(HttpServerContext *);
|
||||
|
||||
extern Stream *
|
||||
HttpServerStream(HttpServerContext *);
|
||||
|
||||
|
|
Loading…
Reference in a new issue