~ubuntu-branches/ubuntu/saucy/curl/saucy-201307251546

« back to all changes in this revision

Viewing changes to lib/http.c

  • Committer: Package Import Robot
  • Author(s): Alessandro Ghedini
  • Date: 2012-03-23 16:24:51 UTC
  • mto: (3.6.1 experimental) (1.3.1)
  • mto: This revision was merged to the branch mainline in revision 59.
  • Revision ID: package-import@ubuntu.com-20120323162451-z4gstlabjkgnrh7h
Tags: upstream-7.25.0
ImportĀ upstreamĀ versionĀ 7.25.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 *                            | (__| |_| |  _ <| |___
6
6
 *                             \___|\___/|_| \_\_____|
7
7
 *
8
 
 * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
 
8
 * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
9
9
 *
10
10
 * This software is licensed as described in the file COPYING, which
11
11
 * you should have received as part of this distribution. The terms
1309
1309
     function to make the re-use checks properly be able to check this bit. */
1310
1310
  conn->bits.close = FALSE;
1311
1311
 
1312
 
#ifndef CURL_DISABLE_PROXY
1313
 
  /* If we are not using a proxy and we want a secure connection, perform SSL
1314
 
   * initialization & connection now.  If using a proxy with https, then we
1315
 
   * must tell the proxy to CONNECT to the host we want to talk to.  Only
1316
 
   * after the connect has occurred, can we start talking SSL
1317
 
   */
1318
 
  if(conn->bits.tunnel_proxy && conn->bits.httpproxy) {
1319
 
 
1320
 
    /* either SSL over proxy, or explicitly asked for */
1321
 
    result = Curl_proxyCONNECT(conn, FIRSTSOCKET,
1322
 
                               conn->host.name,
1323
 
                               conn->remote_port);
1324
 
    if(CURLE_OK != result)
 
1312
  if(data->state.used_interface == Curl_if_multi) {
 
1313
    /* when the multi interface is used, the CONNECT procedure might not have
 
1314
       been completed */
 
1315
    result = Curl_proxy_connect(conn);
 
1316
    if(result)
1325
1317
      return result;
1326
1318
  }
1327
1319
 
1328
 
  if(conn->bits.tunnel_connecting) {
 
1320
  if(conn->tunnel_state[FIRSTSOCKET] == TUNNEL_CONNECT)
1329
1321
    /* nothing else to do except wait right now - we're not done here. */
1330
1322
    return CURLE_OK;
1331
 
  }
1332
 
#endif /* CURL_DISABLE_PROXY */
1333
1323
 
1334
1324
  if(conn->given->flags & PROTOPT_SSL) {
1335
1325
    /* perform SSL initialization */
1857
1847
      /* ignore empty data */
1858
1848
      free(cookiehost);
1859
1849
    else {
1860
 
      char *colon = strchr(cookiehost, ':');
1861
 
      if(colon)
1862
 
        *colon = 0; /* The host must not include an embedded port number */
 
1850
      /* If the host begins with '[', we start searching for the port after
 
1851
         the bracket has been closed */
 
1852
      int startsearch = 0;
 
1853
      if(*cookiehost == '[') {
 
1854
        char *closingbracket;
 
1855
        closingbracket = strchr(cookiehost+1, ']');
 
1856
        if(closingbracket)
 
1857
          *closingbracket = 0;
 
1858
        /* since the 'cookiehost' is an allocated memory area that will be
 
1859
           freed later we cannot simply increment the pointer */
 
1860
        memmove(cookiehost, cookiehost + 1, strlen(cookiehost) - 1);
 
1861
      }
 
1862
      else {
 
1863
        char *colon = strchr(cookiehost + startsearch, ':');
 
1864
        if(colon)
 
1865
          *colon = 0; /* The host must not include an embedded port number */
 
1866
      }
1863
1867
      Curl_safefree(conn->allocptr.cookiehost);
1864
1868
      conn->allocptr.cookiehost = cookiehost;
1865
1869
    }