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

« back to all changes in this revision

Viewing changes to lib/http.c

  • Committer: Bazaar Package Importer
  • Author(s): Ramakrishnan Muthukrishnan
  • Date: 2011-02-28 19:35:36 UTC
  • mto: (3.6.1 experimental) (1.3.1)
  • mto: This revision was merged to the branch mainline in revision 47.
  • Revision ID: james.westby@ubuntu.com-20110228193536-p3a9jawxxofcsz7o
Tags: upstream-7.21.4
ImportĀ upstreamĀ versionĀ 7.21.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 *                            | (__| |_| |  _ <| |___
6
6
 *                             \___|\___/|_| \_\_____|
7
7
 *
8
 
 * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
 
8
 * Copyright (C) 1998 - 2011, 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
520
520
  struct SessionHandle *data = conn->data;
521
521
  const char *auth=NULL;
522
522
  CURLcode result = CURLE_OK;
523
 
#ifdef HAVE_GSSAPI
 
523
#ifdef USE_HTTP_NEGOTIATE
524
524
  struct negotiatedata *negdata = proxy?
525
525
    &data->state.proxyneg:&data->state.negotiate;
526
526
#endif
530
530
  (void)path;
531
531
#endif
532
532
 
533
 
#ifdef HAVE_GSSAPI
 
533
#ifdef USE_HTTP_NEGOTIATE
534
534
  if((authstatus->picked == CURLAUTH_GSSNEGOTIATE) &&
535
535
     negdata->context && !GSS_ERROR(negdata->status)) {
536
536
    auth="GSS-Negotiate";
727
727
   *
728
728
   */
729
729
 
730
 
#ifdef HAVE_GSSAPI
 
730
#ifdef USE_HTTP_NEGOTIATE
731
731
  if(checkprefix("GSS-Negotiate", start) ||
732
732
      checkprefix("Negotiate", start)) {
733
733
    int neg;
1881
1881
  (void)numsocks;
1882
1882
  return GETSOCK_BLANK;
1883
1883
}
1884
 
#endif
1885
 
#endif
1886
 
#endif
1887
 
#endif
 
1884
#else
 
1885
#ifdef USE_AXTLS
 
1886
static int https_getsock(struct connectdata *conn,
 
1887
                         curl_socket_t *socks,
 
1888
                         int numsocks)
 
1889
{
 
1890
  (void)conn;
 
1891
  (void)socks;
 
1892
  (void)numsocks;
 
1893
  return GETSOCK_BLANK;
 
1894
}
 
1895
#endif /* USE_AXTLS */
 
1896
#endif /* USE_POLARSSL */
 
1897
#endif /* USE_QSOSSL */
 
1898
#endif /* USE_NSS */
 
1899
#endif /* USE_SSLEAY || USE_GNUTLS */
1888
1900
 
1889
1901
/*
1890
1902
 * Curl_http_done() gets called from Curl_done() after a single HTTP request
2040
2052
CURLcode Curl_add_timecondition(struct SessionHandle *data,
2041
2053
                                Curl_send_buffer *req_buffer)
2042
2054
{
2043
 
  struct tm *tm;
 
2055
  const struct tm *tm;
2044
2056
  char *buf = data->state.buffer;
2045
2057
  CURLcode result = CURLE_OK;
 
2058
  struct tm keeptime;
 
2059
 
 
2060
  result = Curl_gmtime(data->set.timevalue, &keeptime);
 
2061
  if(result) {
 
2062
    failf(data, "Invalid TIMEVALUE\n");
 
2063
    return result;
 
2064
  }
 
2065
  tm = &keeptime;
2046
2066
 
2047
2067
  /* The If-Modified-Since header family should have their times set in
2048
2068
   * GMT as RFC2616 defines: "All HTTP date/time stamps MUST be
2051
2071
   * Time)." (see page 20 of RFC2616).
2052
2072
   */
2053
2073
 
2054
 
#ifdef HAVE_GMTIME_R
2055
 
  /* thread-safe version */
2056
 
  struct tm keeptime;
2057
 
  tm = (struct tm *)gmtime_r(&data->set.timevalue, &keeptime);
2058
 
#else
2059
 
  tm = gmtime(&data->set.timevalue);
2060
 
#endif
2061
 
 
2062
2074
  /* format: "Tue, 15 Nov 1994 12:45:26 GMT" */
2063
2075
  snprintf(buf, BUFSIZE-1,
2064
2076
           "%s, %02d %s %4d %02d:%02d:%02d GMT",
2642
2654
#endif
2643
2655
 
2644
2656
  if(data->set.timecondition) {
2645
 
      result = Curl_add_timecondition(data, req_buffer);
 
2657
    result = Curl_add_timecondition(data, req_buffer);
2646
2658
    if(result)
2647
2659
      return result;
2648
2660
  }
3711
3723
        return result;
3712
3724
    }
3713
3725
    else if((k->httpcode >= 300 && k->httpcode < 400) &&
3714
 
            checkprefix("Location:", k->p)) {
 
3726
            checkprefix("Location:", k->p) &&
 
3727
            !data->req.location) {
3715
3728
      /* this is the URL that the server advises us to use instead */
3716
3729
      char *location = Curl_copy_header_value(k->p);
3717
3730
      if (!location)
3720
3733
        /* ignore empty data */
3721
3734
        free(location);
3722
3735
      else {
3723
 
        DEBUGASSERT(!data->req.location);
3724
3736
        data->req.location = location;
3725
3737
 
3726
3738
        if(data->set.http_follow_location) {