mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-09-28 04:09:31 +03:00
Partial revert of 82abaee62f
No need to process part of code if some variables length are zeros. Non-NULL pointers can point to zero-length strings, but if pointer is NULL the length is always zero. For example 'req_body' could be not be NULL, but as long as 'req_body_size' is zero, no chunk must be added.
This commit is contained in:
@@ -553,11 +553,9 @@ _MHD_dumbClient_create (uint16_t port, const char *method, const char *url,
|
||||
": chunked\r\n");
|
||||
}
|
||||
}
|
||||
if (NULL != add_headers)
|
||||
if (0 != add_hdrs_size)
|
||||
{
|
||||
memcpy (send_buf + clnt->req_size,
|
||||
add_headers,
|
||||
add_hdrs_size);
|
||||
memcpy (send_buf + clnt->req_size, add_headers, add_hdrs_size);
|
||||
clnt->req_size += add_hdrs_size;
|
||||
}
|
||||
/* Terminate header */
|
||||
@@ -567,7 +565,7 @@ _MHD_dumbClient_create (uint16_t port, const char *method, const char *url,
|
||||
/* Add body (if any) */
|
||||
if (! chunked)
|
||||
{
|
||||
if (NULL != req_body)
|
||||
if (0 != req_body_size)
|
||||
{
|
||||
memcpy (send_buf + clnt->req_size, req_body, req_body_size);
|
||||
clnt->req_size += req_body_size;
|
||||
@@ -575,7 +573,7 @@ _MHD_dumbClient_create (uint16_t port, const char *method, const char *url,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NULL != req_body)
|
||||
if (0 != req_body_size)
|
||||
{
|
||||
int prn_size;
|
||||
prn_size = snprintf (send_buf + clnt->req_size,
|
||||
|
||||
Reference in New Issue
Block a user