diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/curl-wrap.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/curl-wrap.c b/src/curl-wrap.c index 3c566a3..9f010fb 100644 --- a/src/curl-wrap.c +++ b/src/curl-wrap.c @@ -170,10 +170,16 @@ int curl_wrap_add_header_value(CURL *curl, const char *name, const char *value) { char *h; int rc; - - rc = asprintf(&h, "%s: %s", name, value); - rc = rc < 0 ? 0 : curl_wrap_add_header(curl, h); - free(h); + size_t sname, svalue; + + sname = strlen(name); + svalue = strlen(value); + h = alloca(sname + svalue + 3); + memcpy(h, name, sname); + h[sname] = ':'; + h[sname + 1] = ' '; + memcpy(h + sname + 2, value, svalue + 1); + rc = curl_wrap_add_header(curl, h); return rc; } |