* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
- * are also available at http://curl.haxx.se/docs/copyright.html.
+ * are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_CRYPTO_AUTH)
#include "urldata.h"
-#include "rawstr.h"
-#include "curl_sasl.h"
+#include "strcase.h"
+#include "vauth/vauth.h"
#include "http_digest.h"
+/* The last 3 #include files should be in this order */
#include "curl_printf.h"
-
-/* The last #include files should be: */
#include "curl_memory.h"
#include "memdebug.h"
const char *header) /* rest of the *-authenticate:
header */
{
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
/* Point to the correct struct with this */
struct digestdata *digest;
while(*header && ISSPACE(*header))
header++;
- return Curl_sasl_decode_digest_http_message(header, digest);
+ return Curl_auth_decode_digest_http_message(header, digest);
}
CURLcode Curl_output_digest(struct connectdata *conn,
const unsigned char *uripath)
{
CURLcode result;
- struct SessionHandle *data = conn->data;
- unsigned char *path;
- char *tmp;
+ struct Curl_easy *data = conn->data;
+ unsigned char *path = NULL;
+ char *tmp = NULL;
char *response;
size_t len;
bool have_chlg;
if(proxy) {
digest = &data->state.proxydigest;
allocuserpwd = &conn->allocptr.proxyuserpwd;
- userp = conn->proxyuser;
- passwdp = conn->proxypasswd;
+ userp = conn->http_proxy.user;
+ passwdp = conn->http_proxy.passwd;
authp = &data->state.authproxy;
}
else {
Apache servers can be set to do the Digest IE-style automatically using
the BrowserMatch feature:
- http://httpd.apache.org/docs/2.2/mod/mod_auth_digest.html#msie
+ https://httpd.apache.org/docs/2.2/mod/mod_auth_digest.html#msie
Further details on Digest implementation differences:
http://www.fngtps.com/2006/09/http-authentication
*/
- if(authp->iestyle && ((tmp = strchr((char *)uripath, '?')) != NULL)) {
- size_t urilen = tmp - (char *)uripath;
-
- path = (unsigned char *) aprintf("%.*s", urilen, uripath);
+ if(authp->iestyle) {
+ tmp = strchr((char *)uripath, '?');
+ if(tmp) {
+ size_t urilen = tmp - (char *)uripath;
+ path = (unsigned char *) aprintf("%.*s", urilen, uripath);
+ }
}
- else
+ if(!tmp)
path = (unsigned char *) strdup((char *) uripath);
if(!path)
return CURLE_OUT_OF_MEMORY;
- result = Curl_sasl_create_digest_http_message(data, userp, passwdp, request,
+ result = Curl_auth_create_digest_http_message(data, userp, passwdp, request,
path, digest, &response, &len);
free(path);
if(result)
return CURLE_OK;
}
-void Curl_digest_cleanup(struct SessionHandle *data)
+void Curl_digest_cleanup(struct Curl_easy *data)
{
- Curl_sasl_digest_cleanup(&data->state.digest);
- Curl_sasl_digest_cleanup(&data->state.proxydigest);
+ Curl_auth_digest_cleanup(&data->state.digest);
+ Curl_auth_digest_cleanup(&data->state.proxydigest);
}
#endif