mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
[core,gateway] add http_request_append_header
This commit is contained in:
@@ -1486,7 +1486,7 @@ HttpResponse* http_response_recv(rdpTls* tls, BOOL readContentLength)
|
||||
WINPR_ASSERT(response->BodyLength == 0);
|
||||
bodyLength = response->BodyLength; /* expected body length */
|
||||
|
||||
if (readContentLength)
|
||||
if (readContentLength && (response->BodyLength > 0))
|
||||
{
|
||||
const char* cur = response->ContentType;
|
||||
|
||||
@@ -1737,3 +1737,18 @@ void http_response_log_error_status_(wLog* log, DWORD level, const HttpResponse*
|
||||
freerdp_http_status_string_format(status, buffer, ARRAYSIZE(buffer)));
|
||||
http_response_print(log, level, response, file, line, fkt);
|
||||
}
|
||||
|
||||
WINPR_ATTR_FORMAT_ARG(3, 4)
|
||||
BOOL http_request_append_header(wStream* stream, const char* param,
|
||||
WINPR_FORMAT_ARG const char* value, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, value);
|
||||
char* str = NULL;
|
||||
size_t slen = 0;
|
||||
winpr_vasprintf(&str, &slen, value, ap);
|
||||
va_end(ap);
|
||||
const BOOL rc = http_encode_body_line(stream, param, str);
|
||||
free(str);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -104,6 +104,10 @@ FREERDP_LOCAL BOOL http_request_set_transfer_encoding(HttpRequest* request,
|
||||
|
||||
FREERDP_LOCAL wStream* http_request_write(HttpContext* context, HttpRequest* request);
|
||||
|
||||
WINPR_ATTR_FORMAT_ARG(3, 4)
|
||||
FREERDP_LOCAL BOOL http_request_append_header(wStream* stream, const char* param,
|
||||
WINPR_FORMAT_ARG const char* value, ...);
|
||||
|
||||
/* HTTP response */
|
||||
typedef struct s_http_response HttpResponse;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user