Re[2]: [patches] Re[2]: [PATCH] add support for http+unix protocol

Konstantin Belyavskiy k.belyavskiy at tarantool.org
Fri Jan 26 18:29:54 MSK 2018


Done


>Пятница, 26 января 2018, 17:19 +03:00 от Vladimir Davydov <vdavydov.dev at gmail.com>:
>
>On Fri, Jan 26, 2018 at 05:02:38PM +0300, Konstantin Belyavskiy wrote:
>> Revert back version with malloc
>
>Please, attach patches to avoid mangling if your MUA doesn't support
>plain text.
>
>> + char *http_url = (char *) malloc(strlen(HTTP_LOCALHOST) +
>> + url_len - prefix_len + 1);
>
>Please handle malloc() failures.
>
>> +
>> + const char *socket_path_start = url + prefix_len;
>> + const char *socket_path_end = strchr(socket_path_start, '/');
>> + if (socket_path_end == NULL)
>> + socket_path_end = url + url_len;
>> +
>> + char *socket_path = (char *) malloc(socket_path_end - socket_path_start + 1);
>> + urldecode(socket_path_start, socket_path_end, socket_path);
>> + sprintf(http_url, "%s%s", HTTP_LOCALHOST, socket_path_end);
>> +
>> + curl_easy_setopt(req->curl_request.easy, CURLOPT_UNIX_SOCKET_PATH, socket_path);
>> + curl_easy_setopt(req->curl_request.easy, CURLOPT_URL, http_url);
>> +
>> + free(http_url);
>> + free(socket_path);
>> + } else {
>> + curl_easy_setopt(req->curl_request.easy, CURLOPT_URL, url);
>> + }


С уважением,
Konstantin Belyavskiy
k.belyavskiy at tarantool.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20180126/64db7702/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-httpc-add-support-for-http-unix-protocol.patch
Type: application/x-patch
Size: 3041 bytes
Desc: not available
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20180126/64db7702/attachment.bin>


More information about the Tarantool-patches mailing list