0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-28 00:14:07 +01:00

ircd::server: Fix loghead() failure conditions.

This commit is contained in:
Jason Volk 2019-03-25 18:43:00 -07:00
parent 84d4ca485b
commit 0f184cd449

View file

@ -340,13 +340,20 @@ ircd::server::loghead(const mutable_buffer &buf,
const request &request) const request &request)
try try
{ {
if(empty(request.in.head)) if(empty(request.out.head))
return "<no header>"; return "<no head>";
parse::buffer pb{request.out.head}; parse::buffer pb{request.out.head};
parse::capstan pc{pb}; parse::capstan pc{pb, [](char *&read, char *stop)
{
read = stop;
}};
pc.read += size(request.out.head); pc.read += size(request.out.head);
const http::request::head head{pc}; const http::request::head head{pc};
if(!head.method || !head.path)
return "<no head data>";
return fmt::sprintf return fmt::sprintf
{ {
buf, "%s %s", head.method, head.path buf, "%s %s", head.method, head.path