mirror of
https://github.com/curl/curl.git
synced 2026-08-25 13:33:36 +03:00
- David McCreedy provided libcurl changes for doing HTTP communication on
non-ASCII platforms. It does add some complexity, most notably with more #ifdefs, but I want to see this supported added and I can't see how we can add it without the extra stuff added.
This commit is contained in:
parent
c8afb02b4c
commit
0fb5a65a58
10 changed files with 299 additions and 61 deletions
|
|
@ -39,6 +39,7 @@
|
|||
#include "strtok.h"
|
||||
#include "url.h" /* for Curl_safefree() */
|
||||
#include "memory.h"
|
||||
#include "easyif.h" /* included for Curl_convert_... prototypes */
|
||||
|
||||
#define _MPRINTF_REPLACE /* use our functions only */
|
||||
#include <curl/mprintf.h>
|
||||
|
|
@ -234,6 +235,21 @@ CURLcode Curl_output_digest(struct connectdata *conn,
|
|||
|
||||
struct SessionHandle *data = conn->data;
|
||||
struct digestdata *d;
|
||||
#ifdef CURL_DOES_CONVERSIONS
|
||||
CURLcode rc;
|
||||
/* The CURL_OUTPUT_DIGEST_CONV macro below is for non-ASCII machines.
|
||||
It converts digest text to ASCII so the MD5 will be correct for
|
||||
what ultimately goes over the network.
|
||||
*/
|
||||
#define CURL_OUTPUT_DIGEST_CONV(a, b) \
|
||||
rc = Curl_convert_to_network(a, (char *)b, strlen((const char*)b)); \
|
||||
if (rc != CURLE_OK) { \
|
||||
free(b); \
|
||||
return rc; \
|
||||
}
|
||||
#else
|
||||
#define CURL_OUTPUT_DIGEST_CONV(a, b)
|
||||
#endif /* CURL_DOES_CONVERSIONS */
|
||||
|
||||
if(proxy) {
|
||||
d = &data->state.proxydigest;
|
||||
|
|
@ -291,6 +307,8 @@ CURLcode Curl_output_digest(struct connectdata *conn,
|
|||
aprintf("%s:%s:%s", userp, d->realm, passwdp);
|
||||
if(!md5this)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
CURL_OUTPUT_DIGEST_CONV(data, md5this); /* convert on non-ASCII machines */
|
||||
Curl_md5it(md5buf, md5this);
|
||||
free(md5this); /* free this again */
|
||||
|
||||
|
|
@ -305,6 +323,7 @@ CURLcode Curl_output_digest(struct connectdata *conn,
|
|||
tmp = aprintf("%s:%s:%s", ha1, d->nonce, d->cnonce);
|
||||
if(!tmp)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
CURL_OUTPUT_DIGEST_CONV(data, tmp); /* convert on non-ASCII machines */
|
||||
Curl_md5it(md5buf, (unsigned char *)tmp);
|
||||
free(tmp); /* free this again */
|
||||
md5_to_ascii(md5buf, ha1);
|
||||
|
|
@ -334,6 +353,7 @@ CURLcode Curl_output_digest(struct connectdata *conn,
|
|||
entity-body here */
|
||||
/* TODO: Append H(entity-body)*/
|
||||
}
|
||||
CURL_OUTPUT_DIGEST_CONV(data, md5this); /* convert on non-ASCII machines */
|
||||
Curl_md5it(md5buf, md5this);
|
||||
free(md5this); /* free this again */
|
||||
md5_to_ascii(md5buf, ha2);
|
||||
|
|
@ -357,6 +377,7 @@ CURLcode Curl_output_digest(struct connectdata *conn,
|
|||
if(!md5this)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
CURL_OUTPUT_DIGEST_CONV(data, md5this); /* convert on non-ASCII machines */
|
||||
Curl_md5it(md5buf, md5this);
|
||||
free(md5this); /* free this again */
|
||||
md5_to_ascii(md5buf, request_digest);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue