Restore ctype.h character classification for non-ASCII platforms#2494
Restore ctype.h character classification for non-ASCII platforms#2494smuehlst wants to merge 4 commits intocurl:masterfrom
Conversation
With commit 4272a0b curl-speficic character classification macros and functions were introduced in curl_ctype.[ch] to avoid dependencies on the locale. This broke curl on non-ASCII, e.g. EBCDIC platforms. This change restores the previous set of character classification macros when CURL_DOES_CONVERSIONS is defined.
strcpy_url() had a hard-coded dependency on ASCII to work because of an explicit character comparison for being greater or equal than 0x80.
|
I added a second fix for |
|
The red travis is a While the warning looks a bit wrong there, I think you could improve the readability of that code by not having the semicolon "hidden" like that after a comment. |
|
Sorry, I had thought I had run "make checksrc", but apparently I did run it for the wrong sources. Fixed. |
|
Test case 255 is failing in in one of the travis builds, while it is succeeding in all other builds: https://travis-ci.org/curl/curl/jobs/367525539 What does that tell me? I doubt that the failure could be related to my change, given the fact that for ASCII platforms it has no effect. |
|
It seems to be a test that started to become flaky (for other PRs as well) and shouldn't be related. I've triggered a rerun of it now. |
So this is because you're checking ascii input so you don't want Curl_isxdigit() because that assumes the non-ascii input in your case? In all ascii-based systems however, Curl_isxdigit_ascii() adds nothing but is simply a tad bit slower... I propose that we then introduce a |
Correct. The above comment comes from the old code that was present in http_chunks.c before commit 4272a0b: Line 78 in 93836e2 I restored this code and renamed the old Curl_isxdigit() function to Curl_isxdigit_ascii() with the hope to avoid confusion.
Sounds reasonable to me. Do I understand it correctly that the current Curl_isxdigit_ascii() function shall be kept for the non-ASCII case and the define will be used for the ASCII case, like this: |
|
Right, that's exactly what I was thinking! |
While for non-ASCII hosts a special function is needed to check for a hex digit in ASCII encoding, on ASCII hosts the normal Curl_isxdigit function can be used.
|
Pull request updated accordingly. |
|
Thanks! |
OSS-Fuzz detected https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8000 Broke in dd7521b
With commit 4272a0b curl-specific
character classification macros and functions were introduced
in curl_ctype.[ch] to avoid dependencies on the locale. This broke
curl on non-ASCII, e.g. EBCDIC platforms. This change restores the
previous set of character classification macros when
CURL_DOES_CONVERSIONS is defined.
This was discovered on a z/OS machine with EBCDIC encoding, where Content-type headers could no longer be matched because leading blanks were no longer stripped off by curl.