~ubuntu-branches/ubuntu/trusty/curl/trusty

« back to all changes in this revision

Viewing changes to lib/http_digest.c

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2013-12-20 09:13:22 UTC
  • mfrom: (3.4.44 sid)
  • Revision ID: package-import@ubuntu.com-20131220091322-lqk9xf5wba7vsyfh
Tags: 7.34.0-1ubuntu1
* Resynchronize on Debian, remaining changes
  - Drop dependencies not in main:
    + Build-Depends: Drop stunnel4 and libssh2-1-dev.
    + Drop libssh2-1-dev from binary package Depends.
  - Add new libcurl3-udeb package.
  - Add new curl-udeb package.
* Dropped undocumented Build-Depends change to automake1.9.

Show diffs side-by-side

added added

removed removed

Lines of Context:
141
141
    d = &data->state.digest;
142
142
  }
143
143
 
144
 
  /* skip initial whitespaces */
145
 
  while(*header && ISSPACE(*header))
146
 
    header++;
147
 
 
148
144
  if(checkprefix("Digest", header)) {
149
145
    header += strlen("Digest");
150
146
 
306
302
  /* We have a Digest setup for this, use it!  Now, to get all the details for
307
303
     this sorted out, I must urge you dear friend to read up on the RFC2617
308
304
     section 3.2.2, */
 
305
  size_t urilen;
309
306
  unsigned char md5buf[16]; /* 16 bytes/128 bits */
310
307
  unsigned char request_digest[33];
311
308
  unsigned char *md5this;
440
437
     Further details on Digest implementation differences:
441
438
     http://www.fngtps.com/2006/09/http-authentication
442
439
  */
443
 
  if(authp->iestyle && ((tmp = strchr((char *)uripath, '?')) != NULL)) {
444
 
    md5this = (unsigned char *)aprintf("%s:%.*s", request,
445
 
                                       curlx_sztosi(tmp - (char *)uripath),
446
 
                                       uripath);
447
 
  }
 
440
 
 
441
  if(authp->iestyle && ((tmp = strchr((char *)uripath, '?')) != NULL))
 
442
    urilen = tmp - (char *)uripath;
448
443
  else
449
 
    md5this = (unsigned char *)aprintf("%s:%s", request, uripath);
 
444
    urilen = strlen((char *)uripath);
 
445
 
 
446
  md5this = (unsigned char *)aprintf("%s:%.*s", request, urilen, uripath);
450
447
 
451
448
  if(d->qop && Curl_raw_equal(d->qop, "auth-int")) {
452
449
    /* We don't support auth-int for PUT or POST at the moment.
511
508
               "username=\"%s\", "
512
509
               "realm=\"%s\", "
513
510
               "nonce=\"%s\", "
514
 
               "uri=\"%s\", "
 
511
               "uri=\"%.*s\", "
515
512
               "cnonce=\"%s\", "
516
513
               "nc=%08x, "
517
514
               "qop=%s, "
520
517
               userp_quoted,
521
518
               d->realm,
522
519
               d->nonce,
523
 
               uripath, /* this is the PATH part of the URL */
 
520
               urilen, uripath, /* this is the PATH part of the URL */
524
521
               d->cnonce,
525
522
               d->nc,
526
523
               d->qop,
537
534
               "username=\"%s\", "
538
535
               "realm=\"%s\", "
539
536
               "nonce=\"%s\", "
540
 
               "uri=\"%s\", "
 
537
               "uri=\"%.*s\", "
541
538
               "response=\"%s\"",
542
539
               proxy?"Proxy-":"",
543
540
               userp_quoted,
544
541
               d->realm,
545
542
               d->nonce,
546
 
               uripath, /* this is the PATH part of the URL */
 
543
               urilen, uripath, /* this is the PATH part of the URL */
547
544
               request_digest);
548
545
  }
549
546
  Curl_safefree(userp_quoted);