aboutsummaryrefslogtreecommitdiff
path: root/lib/url.c
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2009-01-21 04:42:47 +0000
committerDan Fandrich <dan@coneharvesters.com>2009-01-21 04:42:47 +0000
commit5591550167092c0e5f307b3c2c87f44518e7159f (patch)
tree7fc43fd73fc132099fc7a9c6c740484ad29d4c82 /lib/url.c
parent6bb9ef8de4273e0f5f5e499eb61a972b3644f70f (diff)
Fixed a couple more locale-dependent toupper conversions, mainly for
clarity. This does fix one problem that causes ;type=i FTP URLs to fail in the Turkish locale when CURLOPT_PROXY_TRANSFER_MODE is used (test case 561) Added tests 561 and 1092 through 1094 to test various combinations of ;type= and ;mode= URLs that could potentially fail in the Turkish locale.
Diffstat (limited to 'lib/url.c')
-rw-r--r--lib/url.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/url.c b/lib/url.c
index 0145d4935..47d2af342 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -230,6 +230,21 @@ void Curl_safefree(void *ptr)
free(ptr);
}
+/* Copy an upper case version of the string from src to dest. The
+ * strings may overlap. No more than n characters of the string are copied
+ * (including any NUL) and the destination string will NOT be
+ * NUL-terminated if that limit is reached.
+ */
+void Curl_strntoupper(char *dest, const char *src, size_t n)
+{
+ if (n < 1)
+ return;
+
+ do {
+ *dest++ = Curl_raw_toupper(*src);
+ } while (*src++ && --n);
+}
+
static void close_connections(struct SessionHandle *data)
{
/* Loop through all open connections and kill them one by one */
@@ -3441,8 +3456,7 @@ static char *detect_proxy(struct connectdata *conn)
*/
if(!prox && !Curl_raw_equal("http_proxy", proxy_env)) {
/* There was no lowercase variable, try the uppercase version: */
- for(envp = proxy_env; *envp; envp++)
- *envp = (char)toupper((int)*envp);
+ Curl_strntoupper(proxy_env, proxy_env, sizeof(proxy_env));
prox=curl_getenv(proxy_env);
}