1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-04 16:45:06 -05:00

tests: use consistent environment variables for setting charset

Character set in POSIX is set by the locale defined (in decreasing order
of precedence) by the LC_ALL, LC_CTYPE and LANG environment variables (I
believe CHARSET is only historic). LC_ALL is cleared to ensure that
LC_CTYPE takes effect, but LC_ALL is not used to set the locale to
ensure that other parts of the locale aren't overriden, if set.  Since
there doesn't seem to be a cross-platform way of specifying a UTF-8
locale, and not all systems may support UTF-8, a <precheck> is used
(where relevant) to skip the test if UTF-8 isn't in use.  Test 1035 was
also converted to UTF-8 for consistency, as the actual character set
used there is irrelevant to the test.
This commit is contained in:
Dan Fandrich 2017-02-23 21:47:17 +01:00
parent 93cce2489d
commit ecd1d020ab
5 changed files with 28 additions and 7 deletions

View File

@ -33,7 +33,12 @@ idn
</features> </features>
<setenv> <setenv>
CHARSET=UTF-8 CHARSET=UTF-8
LC_ALL=
LC_CTYPE=UTF-8
</setenv> </setenv>
<precheck>
perl -MI18N::Langinfo=langinfo,CODESET -e 'die "Needs a UTF-8 locale" if (lc(langinfo(CODESET())) ne "utf-8");'
</precheck>
<name> <name>
HTTP over proxy with malformatted IDN host name HTTP over proxy with malformatted IDN host name
</name> </name>

View File

@ -33,13 +33,17 @@ idn
</features> </features>
<setenv> <setenv>
CHARSET=UTF-8 CHARSET=UTF-8
LANG=en_US.UTF-8 LC_ALL=
LC_CTYPE=UTF-8
</setenv> </setenv>
<precheck>
perl -MI18N::Langinfo=langinfo,CODESET -e 'die "Needs a UTF-8 locale" if (lc(langinfo(CODESET())) ne "utf-8");'
</precheck>
<name> <name>
HTTP over proxy with too long IDN host name HTTP over proxy with too long IDN host name
</name> </name>
<command> <command>
http://too-long-IDN-name-cürl-rüles-la-la-la-dee-da-flooby-nooby.local/page/1035 -x %HOSTIP:%HTTPPORT http://too-long-IDN-name-cürl-rüles-la-la-la-dee-da-flooby-nooby.local/page/1035 -x %HOSTIP:%HTTPPORT
</command> </command>
</client> </client>
@ -50,8 +54,8 @@ http://too-long-IDN-name-c
^User-Agent:.* ^User-Agent:.*
</strip> </strip>
<protocol> <protocol>
GET http://too-long-IDN-name-cürl-rüles-la-la-la-dee-da-flooby-nooby.local/page/1035 HTTP/1.1 GET http://too-long-IDN-name-cürl-rüles-la-la-la-dee-da-flooby-nooby.local/page/1035 HTTP/1.1
Host: too-long-IDN-name-cürl-rüles-la-la-la-dee-da-flooby-nooby.local Host: too-long-IDN-name-cürl-rüles-la-la-la-dee-da-flooby-nooby.local
Accept: */* Accept: */*
Proxy-Connection: Keep-Alive Proxy-Connection: Keep-Alive

View File

@ -32,8 +32,12 @@ idn
</features> </features>
<setenv> <setenv>
CHARSET=UTF-8 CHARSET=UTF-8
LANG=en_US.UTF-8 LC_ALL=
LC_CTYPE=UTF-8
</setenv> </setenv>
<precheck>
perl -MI18N::Langinfo=langinfo,CODESET -e 'die "Needs a UTF-8 locale" if (lc(langinfo(CODESET())) ne "utf-8");'
</precheck>
<name> <name>
HTTP over proxy with IDN host name HTTP over proxy with IDN host name
</name> </name>

View File

@ -42,8 +42,12 @@ idn
</features> </features>
<setenv> <setenv>
CHARSET=UTF-8 CHARSET=UTF-8
LANG=en_US.UTF-8 LC_ALL=
LC_CTYPE=UTF-8
</setenv> </setenv>
<precheck>
perl -MI18N::Langinfo=langinfo,CODESET -e 'die "Needs a UTF-8 locale" if (lc(langinfo(CODESET())) ne "utf-8");'
</precheck>
<name> <name>
Connection re-use with IDN host name Connection re-use with IDN host name
</name> </name>

View File

@ -43,8 +43,12 @@ idn
</features> </features>
<setenv> <setenv>
CHARSET=UTF-8 CHARSET=UTF-8
LANG=en_US.UTF-8 LC_ALL=
LC_CTYPE=UTF-8
</setenv> </setenv>
<precheck>
perl -MI18N::Langinfo=langinfo,CODESET -e 'die "Needs a UTF-8 locale" if (lc(langinfo(CODESET())) ne "utf-8");'
</precheck>
<name> <name>
Connection re-use with IDN host name over HTTP proxy Connection re-use with IDN host name over HTTP proxy
</name> </name>