[core,gateway] add http_status_string_format

This commit is contained in:
akallabeth 2023-04-06 08:59:45 +02:00 committed by Martin Fleisz
parent 8eec678710
commit 0f1b0cac76
2 changed files with 8 additions and 0 deletions

View File

@ -1242,3 +1242,10 @@ const char* http_status_string(long status)
return "HTTP_STATUS_UNKNOWN";
}
}
char* http_status_string_format(long status, char* buffer, size_t size)
{
const char* code = http_status_string(status);
_snprintf(buffer, size, "%s [%ld]", code, status);
return buffer;
}

View File

@ -142,5 +142,6 @@ FREERDP_LOCAL TRANSFER_ENCODING http_response_get_transfer_encoding(HttpResponse
FREERDP_LOCAL BOOL http_response_is_websocket(HttpContext* http, HttpResponse* response);
FREERDP_LOCAL const char* http_status_string(long status);
FREERDP_LOCAL char* http_status_string_format(long status, char* buffer, size_t size);
#endif /* FREERDP_LIB_CORE_GATEWAY_HTTP_H */