diff --git a/libfreerdp/core/gateway/http.c b/libfreerdp/core/gateway/http.c index dcaad6ec8..58d991be8 100644 --- a/libfreerdp/core/gateway/http.c +++ b/libfreerdp/core/gateway/http.c @@ -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; +} diff --git a/libfreerdp/core/gateway/http.h b/libfreerdp/core/gateway/http.h index 42dcba2ec..ebe5c8b07 100644 --- a/libfreerdp/core/gateway/http.h +++ b/libfreerdp/core/gateway/http.h @@ -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 */