]> granicus.if.org Git - curl/commitdiff
http_negotiate: Calculate service name and proxy service name locally
authorSteve Holme <steve_holme@hotmail.com>
Fri, 8 Apr 2016 17:41:41 +0000 (18:41 +0100)
committerSteve Holme <steve_holme@hotmail.com>
Fri, 8 Apr 2016 17:41:41 +0000 (18:41 +0100)
Calculate the service name and proxy service names locally, rather than
in url.c which will allow for us to support overriding the service name
for other protocols such as FTP, IMAP, POP3 and SMTP.

lib/http_negotiate.c
lib/url.c
lib/url.h

index 9e1a83cccd643705abb26c8eaa1e8d758965cafe..92113eb0784e2ef964e9c714eec277a7fa33f155 100644 (file)
@@ -53,14 +53,16 @@ CURLcode Curl_input_negotiate(struct connectdata *conn, bool proxy,
   if(proxy) {
     userp = conn->proxyuser;
     passwdp = conn->proxypasswd;
-    service = data->set.str[STRING_PROXY_SERVICE_NAME];
+    service = data->set.str[STRING_PROXY_SERVICE_NAME] ?
+              data->set.str[STRING_PROXY_SERVICE_NAME] : "HTTP";
     host = conn->proxy.name;
     neg_ctx = &data->state.proxyneg;
   }
   else {
     userp = conn->user;
     passwdp = conn->passwd;
-    service = data->set.str[STRING_SERVICE_NAME];
+    service = data->set.str[STRING_SERVICE_NAME] ?
+              data->set.str[STRING_SERVICE_NAME] : "HTTP";
     host = conn->host.name;
     neg_ctx = &data->state.negotiate;
   }
index d20c36928c6afab4611bd58bff2f96a0868383e1..5705252c4aaeedd37ce148529e87dfaf0ac40cd9 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -576,18 +576,6 @@ CURLcode Curl_init_userdefined(struct UserDefined *set)
                      CURL_DEFAULT_SOCKS5_GSSAPI_SERVICE);
   if(result)
     return result;
-
-  /* set default negotiate proxy service name */
-  result = setstropt(&set->str[STRING_PROXY_SERVICE_NAME],
-                     CURL_DEFAULT_PROXY_SERVICE_NAME);
-  if(result)
-    return result;
-
-  /* set default negotiate service name */
-  result = setstropt(&set->str[STRING_SERVICE_NAME],
-                     CURL_DEFAULT_SERVICE_NAME);
-  if(result)
-    return result;
 #endif
 
   /* This is our preferred CA cert bundle/path since install time */
index 554680f8e98ee615fb047a3d145be544fb0ed782..e7a9ddf080c0e6bc175ca3913218ca71851b5984 100644 (file)
--- a/lib/url.h
+++ b/lib/url.h
@@ -69,9 +69,6 @@ void Curl_close_connections(struct SessionHandle *data);
 #define CURL_DEFAULT_PROXY_PORT 1080 /* default proxy port unless specified */
 #define CURL_DEFAULT_SOCKS5_GSSAPI_SERVICE "rcmd" /* default socks5 gssapi
                                                      service */
-#define CURL_DEFAULT_PROXY_SERVICE_NAME "HTTP" /* default negotiate proxy
-                                                  service */
-#define CURL_DEFAULT_SERVICE_NAME "HTTP"  /* default negotiate service */
 
 CURLcode Curl_connected_proxy(struct connectdata *conn, int sockindex);