Commit 1f8023ce authored by Isaac Boukris's avatar Isaac Boukris Committed by Jay Satiro
Browse files

url: fix unix-socket support for proxy-disabled builds

Prior to this change if curl was built with Unix Socket support
(--enable-unix-sockets) and without Proxy support (--disable-proxy) then
unix socket options would erroneously be ignored.

Regression introduced in:
0b8d682f

Bug: https://github.com/curl/curl/issues/1274


Reported-by: default avatar <mccormickt12@users.noreply.github.com>

Closes https://github.com/curl/curl/pull/1289
parent f7285cc0
Loading
Loading
Loading
Loading
+15 −11
Original line number Diff line number Diff line
@@ -6256,6 +6256,17 @@ static CURLcode create_conn(struct Curl_easy *data,
    }
  }

#ifdef USE_UNIX_SOCKETS
  if(data->set.str[STRING_UNIX_SOCKET_PATH]) {
    conn->unix_domain_socket = strdup(data->set.str[STRING_UNIX_SOCKET_PATH]);
    if(conn->unix_domain_socket == NULL) {
      result = CURLE_OUT_OF_MEMORY;
      goto out;
    }
    conn->abstract_unix_socket = data->set.abstract_unix_socket;
  }
#endif

#ifndef CURL_DISABLE_PROXY
  /*************************************************************
   * Extract the user and password from the authentication string
@@ -6310,18 +6321,11 @@ static CURLcode create_conn(struct Curl_easy *data,
  Curl_safefree(no_proxy);

#ifdef USE_UNIX_SOCKETS
  if(data->set.str[STRING_UNIX_SOCKET_PATH]) {
    if(proxy) {
      free(proxy); /* Unix domain sockets cannot be proxied, so disable it */
  /* For the time being do not mix proxy and unix domain sockets. See #1274 */
  if(proxy && conn->unix_domain_socket) {
    free(proxy);
    proxy = NULL;
  }
    conn->unix_domain_socket = strdup(data->set.str[STRING_UNIX_SOCKET_PATH]);
    if(conn->unix_domain_socket == NULL) {
      result = CURLE_OUT_OF_MEMORY;
      goto out;
    }
    conn->abstract_unix_socket = data->set.abstract_unix_socket;
  }
#endif

  if(proxy && (!*proxy || (conn->handler->flags & PROTOPT_NONETWORK))) {