Re: [PATCH] libghttp and locale != C



Christian Marillat wrote:

> Here is a patch to solve a problem with http headers if locale are different
> than C.
> 
> Christian
> 
>    if (a_conn->proxy_host)
>      {
> +      char *old_locale = strdup (setlocale (LC_NUMERIC, NULL));
> +      setlocale (LC_NUMERIC, "C");
>        l_request_len = sprintf(l_request,
>                               "%s %s HTTP/%01.1f\r\n",
>                               http_req_type_char[a_req->type],
>                               a_req->full_uri,
>                               a_req->http_ver);
> +            setlocale (LC_NUMERIC, old_locale);
> +            free (old_locale);

[...]

Hm. If that library could be used by multithreaded programs (and I don't
see why not), then you can't call setlocale() in it, because it might
change locale for some unrelated thread and cause the same type of bug
you're trying to fix.

-- 
 .-.   .-.    Sarcasm is just one more service we offer.
(_  \ /  _)
     |        dave arsdigita com
     |




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]