Repository: incubator-hawq Updated Branches: refs/heads/HAWQ-932 [created] 66e482120
HAWQ-932. Added pxf service address to curl resolution. Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/66e48212 Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/66e48212 Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/66e48212 Branch: refs/heads/HAWQ-932 Commit: 66e482120f880d915e26187c37f6173cb768ba75 Parents: 69f3c90 Author: Oleksandr Diachenko <[email protected]> Authored: Tue Jul 19 16:46:43 2016 -0700 Committer: Oleksandr Diachenko <[email protected]> Committed: Tue Jul 19 16:46:43 2016 -0700 ---------------------------------------------------------------------- src/backend/access/external/libchurl.c | 16 ++++++++++++++++ src/include/access/libchurl.h | 2 ++ 2 files changed, 18 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/66e48212/src/backend/access/external/libchurl.c ---------------------------------------------------------------------- diff --git a/src/backend/access/external/libchurl.c b/src/backend/access/external/libchurl.c index 5af0ea9..cc81076 100644 --- a/src/backend/access/external/libchurl.c +++ b/src/backend/access/external/libchurl.c @@ -312,6 +312,14 @@ CHURL_HANDLE churl_init_upload(const char* url, CHURL_HEADERS headers) context->upload = true; clear_error_buffer(context); + /* needed to resolve pxf service address */ + struct curl_slist *resolve_hosts = NULL; + char *pxf_host_entry = (char *) palloc0(strlen(pxf_service_address) + strlen(LocalhostIpV4Entry) + 1); + strcat(pxf_host_entry, pxf_service_address); + strcat(pxf_host_entry, LocalhostIpV4Entry); + resolve_hosts = curl_slist_append(NULL, pxf_host_entry); + set_curl_option(context, CURLOPT_RESOLVE, resolve_hosts); + set_curl_option(context, CURLOPT_URL, url); set_curl_option(context, CURLOPT_VERBOSE, (const void*)FALSE); set_curl_option(context, CURLOPT_ERRORBUFFER, context->curl_error_buffer); @@ -341,6 +349,14 @@ CHURL_HANDLE churl_init_download(const char* url, CHURL_HEADERS headers) context->upload = false; clear_error_buffer(context); + /* needed to resolve pxf service address */ + struct curl_slist *resolve_hosts = NULL; + char *pxf_host_entry = (char *) palloc0(strlen(pxf_service_address) + strlen(LocalhostIpV4Entry) + 1); + strcat(pxf_host_entry, pxf_service_address); + strcat(pxf_host_entry, LocalhostIpV4Entry); + resolve_hosts = curl_slist_append(NULL, pxf_host_entry); + set_curl_option(context, CURLOPT_RESOLVE, resolve_hosts); + set_curl_option(context, CURLOPT_URL, url); set_curl_option(context, CURLOPT_VERBOSE, (const void*)FALSE); set_curl_option(context, CURLOPT_ERRORBUFFER, context->curl_error_buffer); http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/66e48212/src/include/access/libchurl.h ---------------------------------------------------------------------- diff --git a/src/include/access/libchurl.h b/src/include/access/libchurl.h index 5db2a06..7f7d420 100644 --- a/src/include/access/libchurl.h +++ b/src/include/access/libchurl.h @@ -143,3 +143,5 @@ void print_http_headers(CHURL_HEADERS headers); #endif + +#define LocalhostIpV4Entry ":127.0.0.1"
