aboutsummaryrefslogtreecommitdiffstats
path: root/tests/libtest/lib517.c
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2018-04-27 16:19:43 -0700
committerElliott Hughes <enh@google.com>2018-05-29 13:40:19 -0700
commitcac3980d6d12690fe9c8aa2ca6bae981c8abb508 (patch)
tree9e228338321c29a79ed20af99d3b2eda7e84f984 /tests/libtest/lib517.c
parent3685a4d3467796179daa96d4c9950b4d2cc34c2e (diff)
downloadexternal_curl-cac3980d6d12690fe9c8aa2ca6bae981c8abb508.tar.gz
external_curl-cac3980d6d12690fe9c8aa2ca6bae981c8abb508.tar.bz2
external_curl-cac3980d6d12690fe9c8aa2ca6bae981c8abb508.zip
Update to 7.59.0 - March 14 2018.
Changes: curl: add --proxy-pinnedpubkey added: CURLOPT_TIMEVALUE_LARGE and CURLINFO_FILETIME_T CURLOPT_RESOLVE: Add support for multiple IP addresses per entry Add option CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS Add new tool option --happy-eyeballs-timeout-ms Add CURLOPT_RESOLVER_START_FUNCTION and CURLOPT_RESOLVER_START_DATA Bugfixes: openldap: check ldap_get_attribute_ber() results for NULL before using FTP: reject path components with control codes readwrite: make sure excess reads don't go beyond buffer end lib555: drop text conversion and encode data as ascii codes lib517: make variable static to avoid compiler warning lib544: sync ascii code data with textual data GSKit: restore pinnedpubkey functionality darwinssl: Don't import client certificates into Keychain on macOS parsedate: fix date parsing for systems with 32 bit long openssl: fix pinned public key build error in FIPS mode SChannel/WinSSL: Implement public key pinning cookies: remove verbose "cookie size:" output progress-bar: don't use stderr explicitly, use bar->out Fixes for MSDOS build: open VC15 projects with VS 2017 curl_ctype: private is*() type macros and functions configure: set PATH_SEPARATOR to colon for PATH w/o separator winbuild: make linker generate proper PDB curl_easy_reset: clear digest auth state curl/curl.h: fix comment typo for CURLOPT_DNS_LOCAL_IP6 range: commonize FTP and FILE range handling progress-bar docs: update to match implementation fnmatch: do not match the empty string with a character set fnmatch: accept an alphanum to be followed by a non-alphanum in char set build: fix termios issue on android cross-compile getdate: return -1 for out of range formdata: use the mime-content type function time-cond: fix reading the file modification time on Windows build-openssl.bat: Extend VC15 support to include Enterprise and Professional build-wolfssl.bat: Extend VC15 support to include Enterprise and Professional openssl: Don't add verify locations when verifypeer==0 fnmatch: optimize processing of consecutive *s and ?s pattern characters schannel: fix compiler warnings content_encoding: Add "none" alias to "identity" get_posix_time: only check for overflows if they can happen http_chunks: don't write chunks twice with CURLOPT_HTTP_TRANSFER_DECODING README: language fix sha256: build with OpenSSL < 0.9.8 smtp: fix processing of initial dot in data --tlsauthtype: works only if libcurl is built with TLS-SRP support tests: new tests for http raw mode libcurl-security.3: man page discussion security concerns when using libcurl curl_gssapi: make sure this file too uses our *printf() BINDINGS: fix curb link (and remove ruby-curl-multi) nss: use PK11_CreateManagedGenericObject() if available travis: add build with iconv enabled ssh: add two missing state names CURLOPT_HEADERFUNCTION.3: mention folded headers http: fix the max header length detection logic header callback: don't chop headers into smaller pieces CURLOPT_HEADER.3: clarify problems with different data sizes curl --version: show PSL if the run-time lib has it enabled examples/sftpuploadresume: resume upload via CURLOPT_APPEND Return error if called recursively from within callbacks sasl: prefer PLAIN mechanism over LOGIN winbuild: Use CALL to run batch scripts curl_share_setopt.3: connection cache is shared within multi handles winbuild: Use macros for the names of some build utilities projects/README: remove reference to dead IDN link/package lib655: silence compiler warning configure: Fix version check for OpenSSL 1.1.1 docs/MANUAL: formfind.pl is not accessible on the site anymore unit1309: fix warning on Windows x64 unit1307: proper cleanup on OOM to fix torture tests curl_ctype: fix macro redefinition warnings build: get CFLAGS (including -werror) used for examples and tests NO_PROXY: fix for IPv6 numericals in the URL krb5: use nondeprecated functions winbuild: prefer documented zlib library names http2: mark the connection for close on GOAWAY limit-rate: kick in even before "limit" data has been received HTTP: allow "header;" to replace an internal header with a blank one http2: verbose output new MAX_CONCURRENT_STREAMS values SECURITY: distros' max embargo time is 14 days curl tool: accept --compressed also if Brotli is enabled and zlib is not WolfSSL: adding TLSv1.3 checksrc.pl: add -i and -m options CURLOPT_COOKIEFILE.3: "-" as file name means stdin Bug: http://b/78771319 Test: builds, boots, `vendor/google/tools/fake-ota on streaming` works Change-Id: I18731dd7c91df36ca92a5dffc8631dee22785e34
Diffstat (limited to 'tests/libtest/lib517.c')
-rw-r--r--tests/libtest/lib517.c228
1 files changed, 126 insertions, 102 deletions
diff --git a/tests/libtest/lib517.c b/tests/libtest/lib517.c
index af7b2aa7..e7451907 100644
--- a/tests/libtest/lib517.c
+++ b/tests/libtest/lib517.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -23,117 +23,141 @@
#include "memdebug.h"
-static const char * const dates[]={
- "Sun, 06 Nov 1994 08:49:37 GMT",
- "Sunday, 06-Nov-94 08:49:37 GMT",
- "Sun Nov 6 08:49:37 1994",
- "06 Nov 1994 08:49:37 GMT",
- "06-Nov-94 08:49:37 GMT",
- "Nov 6 08:49:37 1994",
- "06 Nov 1994 08:49:37",
- "06-Nov-94 08:49:37",
- "1994 Nov 6 08:49:37",
- "GMT 08:49:37 06-Nov-94 Sunday",
- "94 6 Nov 08:49:37",
- "1994 Nov 6",
- "06-Nov-94",
- "Sun Nov 6 94",
- "1994.Nov.6",
- "Sun/Nov/6/94/GMT",
- "Sun, 06 Nov 1994 08:49:37 CET",
- "06 Nov 1994 08:49:37 EST",
- "Sun, 12 Sep 2004 15:05:58 -0700",
- "Sat, 11 Sep 2004 21:32:11 +0200",
- "20040912 15:05:58 -0700",
- "20040911 +0200",
- "Thu, 01-Jan-1970 00:59:59 GMT",
- "Thu, 01-Jan-1970 01:00:00 GMT",
-/* "2094 Nov 6", See ../data/test517 for details */
- "Sat, 15-Apr-17 21:01:22 GMT",
- "Thu, 19-Apr-2007 16:00:00 GMT",
- "Wed, 25 Apr 2007 21:02:13 GMT",
- "Thu, 19/Apr\\2007 16:00:00 GMT",
- "Fri, 1 Jan 2010 01:01:50 GMT",
- "Wednesday, 1-Jan-2003 00:00:00 GMT",
- ", 1-Jan-2003 00:00:00 GMT",
- " 1-Jan-2003 00:00:00 GMT",
- "1-Jan-2003 00:00:00 GMT",
- "Wed,18-Apr-07 22:50:12 GMT",
- "WillyWonka , 18-Apr-07 22:50:12 GMT",
- "WillyWonka , 18-Apr-07 22:50:12",
- "WillyWonka , 18-apr-07 22:50:12",
- "Mon, 18-Apr-1977 22:50:13 GMT",
- "Mon, 18-Apr-77 22:50:13 GMT",
- "\"Sat, 15-Apr-17\\\"21:01:22\\\"GMT\"",
- "Partyday, 18- April-07 22:50:12",
- "Partyday, 18 - Apri-07 22:50:12",
- "Wednes, 1-Januar-2003 00:00:00 GMT",
- "Sat, 15-Apr-17 21:01:22",
- "Sat, 15-Apr-17 21:01:22 GMT-2",
- "Sat, 15-Apr-17 21:01:22 GMT BLAH",
- "Sat, 15-Apr-17 21:01:22 GMT-0400",
- "Sat, 15-Apr-17 21:01:22 GMT-0400 (EDT)",
- "Sat, 15-Apr-17 21:01:22 DST",
- "Sat, 15-Apr-17 21:01:22 -0400",
- "Sat, 15-Apr-17 21:01:22 (hello there)",
- "Sat, 15-Apr-17 21:01:22 11:22:33",
- "Sat, 15-Apr-17 ::00 21:01:22",
- "Sat, 15-Apr-17 boink:z 21:01:22",
- "Sat, 15-Apr-17 91:22:33 21:01:22",
- "Thu Apr 18 22:50:12 2007 GMT",
- "22:50:12 Thu Apr 18 2007 GMT",
- "Thu 22:50:12 Apr 18 2007 GMT",
- "Thu Apr 22:50:12 18 2007 GMT",
- "Thu Apr 18 22:50:12 2007 GMT",
- "Thu Apr 18 2007 22:50:12 GMT",
- "Thu Apr 18 2007 GMT 22:50:12",
- "Sat, 15-Apr-17 21:01:22 GMT",
- "15-Sat, Apr-17 21:01:22 GMT",
- "15-Sat, Apr 21:01:22 GMT 17",
- "15-Sat, Apr 21:01:22 GMT 2017",
- "15 Apr 21:01:22 2017",
- "15 17 Apr 21:01:22",
- "Apr 15 17 21:01:22",
- "Apr 15 21:01:22 17",
- "2017 April 15 21:01:22",
- "15 April 2017 21:01:22",
- "98 April 17 21:01:22",
- "Thu, 012-Aug-2008 20:49:07 GMT",
+struct dcheck {
+ const char *input;
+ time_t output;
+};
+
+static struct dcheck dates[] = {
+ {"Sun, 06 Nov 1994 08:49:37 GMT", 784111777 },
+ {"Sunday, 06-Nov-94 08:49:37 GMT", 784111777 },
+ {"Sun Nov 6 08:49:37 1994", 784111777 },
+ {"06 Nov 1994 08:49:37 GMT", 784111777 },
+ {"06-Nov-94 08:49:37 GMT", 784111777 },
+ {"Nov 6 08:49:37 1994", 784111777 },
+ {"06 Nov 1994 08:49:37", 784111777 },
+ {"06-Nov-94 08:49:37", 784111777 },
+ {"1994 Nov 6 08:49:37", 784111777 },
+ {"GMT 08:49:37 06-Nov-94 Sunday", 784111777 },
+ {"94 6 Nov 08:49:37", 784111777 },
+ {"1994 Nov 6", 784080000 },
+ {"06-Nov-94", 784080000 },
+ {"Sun Nov 6 94", 784080000 },
+ {"1994.Nov.6", 784080000 },
+ {"Sun/Nov/6/94/GMT", 784080000 },
+ {"Sun, 06 Nov 1994 08:49:37 CET", 784108177 },
+ {"06 Nov 1994 08:49:37 EST", 784129777 },
+ {"Sun, 12 Sep 2004 15:05:58 -0700", 1095026758 },
+ {"Sat, 11 Sep 2004 21:32:11 +0200", 1094931131 },
+ {"20040912 15:05:58 -0700", 1095026758 },
+ {"20040911 +0200", 1094853600 },
+ {"Thu, 01-Jan-1970 00:59:59 GMT", 3599 },
+ {"Thu, 01-Jan-1970 01:00:00 GMT", 3600 },
+ {"Sat, 15-Apr-17 21:01:22 GMT", 1492290082 },
+ {"Thu, 19-Apr-2007 16:00:00 GMT", 1176998400 },
+ {"Wed, 25 Apr 2007 21:02:13 GMT", 1177534933 },
+ {"Thu, 19/Apr\\2007 16:00:00 GMT", 1176998400 },
+ {"Fri, 1 Jan 2010 01:01:50 GMT", 1262307710 },
+ {"Wednesday, 1-Jan-2003 00:00:00 GMT", 1041379200 },
+ {", 1-Jan-2003 00:00:00 GMT", 1041379200 },
+ {"1-Jan-2003 00:00:00 GMT", 1041379200 },
+ {"1-Jan-2003 00:00:00 GMT", 1041379200 },
+ {"Wed,18-Apr-07 22:50:12 GMT", 1176936612 },
+ {"WillyWonka , 18-Apr-07 22:50:12 GMT", -1 },
+ {"WillyWonka , 18-Apr-07 22:50:12", -1 },
+ {"WillyWonka , 18-apr-07 22:50:12", -1 },
+ {"Mon, 18-Apr-1977 22:50:13 GMT", 230251813 },
+ {"Mon, 18-Apr-77 22:50:13 GMT", 230251813 },
+ {"Sat, 15-Apr-17\"21:01:22\"GMT", 1492290082 },
+ {"Partyday, 18- April-07 22:50:12", -1 },
+ {"Partyday, 18 - Apri-07 22:50:12", -1 },
+ {"Wednes, 1-Januar-2003 00:00:00 GMT", -1 },
+ {"Sat, 15-Apr-17 21:01:22", 1492290082 },
+ {"Sat, 15-Apr-17 21:01:22 GMT-2", 1492290082 },
+ {"Sat, 15-Apr-17 21:01:22 GMT BLAH", 1492290082 },
+ {"Sat, 15-Apr-17 21:01:22 GMT-0400", 1492290082 },
+ {"Sat, 15-Apr-17 21:01:22 GMT-0400 (EDT)", 1492290082 },
+ {"Sat, 15-Apr-17 21:01:22 DST", -1 },
+ {"Sat, 15-Apr-17 21:01:22 -0400", 1492304482 },
+ {"Sat, 15-Apr-17 21:01:22 (hello there)", -1 },
+ {"Sat, 15-Apr-17 21:01:22 11:22:33", -1 },
+ {"Sat, 15-Apr-17 ::00 21:01:22", -1 },
+ {"Sat, 15-Apr-17 boink:z 21:01:22", -1 },
+ {"Sat, 15-Apr-17 91:22:33 21:01:22", -1 },
+ {"Thu Apr 18 22:50:12 2007 GMT", 1176936612 },
+ {"22:50:12 Thu Apr 18 2007 GMT", 1176936612 },
+ {"Thu 22:50:12 Apr 18 2007 GMT", 1176936612 },
+ {"Thu Apr 22:50:12 18 2007 GMT", 1176936612 },
+ {"Thu Apr 18 22:50:12 2007 GMT", 1176936612 },
+ {"Thu Apr 18 2007 22:50:12 GMT", 1176936612 },
+ {"Thu Apr 18 2007 GMT 22:50:12", 1176936612 },
+ {"Sat, 15-Apr-17 21:01:22 GMT", 1492290082 },
+ {"15-Sat, Apr-17 21:01:22 GMT", 1492290082 },
+ {"15-Sat, Apr 21:01:22 GMT 17", 1492290082 },
+ {"15-Sat, Apr 21:01:22 GMT 2017", 1492290082 },
+ {"15 Apr 21:01:22 2017", 1492290082 },
+ {"15 17 Apr 21:01:22", 1492290082 },
+ {"Apr 15 17 21:01:22", 1492290082 },
+ {"Apr 15 21:01:22 17", 1492290082 },
+ {"2017 April 15 21:01:22", -1 },
+ {"15 April 2017 21:01:22", -1 },
+ {"98 April 17 21:01:22", -1 },
+ {"Thu, 012-Aug-2008 20:49:07 GMT", 1218574147 },
+ {"Thu, 999999999999-Aug-2007 20:49:07 GMT", -1 },
+ {"Thu, 12-Aug-2007 20:61:99999999999 GMT", -1 },
+ {"IAintNoDateFool", -1 },
+ {"Thu Apr 18 22:50 2007 GMT", 1176936600 },
+ {"20110623 12:34:56", 1308832496 },
+ {"20110632 12:34:56", -1 },
+ {"20110623 56:34:56", -1 },
+ {"20111323 12:34:56", -1 },
+ {"20110623 12:34:79", -1 },
+ {"Wed, 31 Dec 2008 23:59:60 GMT", 1230768000 },
+ {"20110623 12:3", 1308830580 },
+ {"20110623 1:3", 1308790980 },
+ {"20110623 1:30", 1308792600 },
+ {"20110623 12:12:3", 1308831123 },
+ {"20110623 01:12:3", 1308791523 },
+ {"20110623 01:99:30", -1 },
+ {"Thu, 01-Jan-1970 00:00:00 GMT", 0 },
+ {"Thu, 31-Dec-1969 23:59:58 GMT", -2 },
+ {"Thu, 31-Dec-1969 23:59:59 GMT", 0 }, /* avoids -1 ! */
+#if SIZEOF_TIME_T > 4
+ {"Sun, 06 Nov 2044 08:49:37 GMT", 2362034977 },
+ {"Sun, 06 Nov 3144 08:49:37 GMT", 37074617377 },
+#ifndef HAVE_TIME_T_UNSIGNED
#if 0
- /* leaving out these strings since they differ between 32 and 64 bit
- archs and the test suite has no good way to support two different outputs
- like that */
- "Thu, 12-Aug-31841 20:49:07 GMT",
- "Thu, 12-Aug-9999999999 20:49:07 GMT",
+ /* causes warning on MSVC */
+ {"Sun, 06 Nov 1900 08:49:37 GMT", -2182259423 },
+#endif
+ {"Sun, 06 Nov 1800 08:49:37 GMT", -5337933023 },
+ {"Thu, 01-Jan-1583 00:00:00 GMT", -12212553600 },
+#endif
+ {"Thu, 01-Jan-1499 00:00:00 GMT", -1 },
+#else
+ {"Sun, 06 Nov 2044 08:49:37 GMT", -1 },
+#endif
+#ifndef HAVE_TIME_T_UNSIGNED
+ {"Sun, 06 Nov 1968 08:49:37 GMT", -36342623 },
#endif
- "Thu, 999999999999-Aug-2007 20:49:07 GMT",
- "Thu, 12-Aug-2007 20:61:99999999999 GMT",
- "IAintNoDateFool",
- "Thu Apr 18 22:50 2007 GMT", /* without seconds */
- "20110623 12:34:56",
- "20110632 12:34:56",
- "20110623 56:34:56",
- "20111323 12:34:56",
- "20110623 12:34:79",
- "Wed, 31 Dec 2008 23:59:60 GMT", /* leap second */
- "20110623 12:3",
- "20110623 1:3",
- "20110623 1:30",
- "20110623 12:12:3",
- "20110623 01:12:3",
- "20110623 01:99:30",
- NULL
+ { NULL, 0 }
};
int test(char *URL)
{
int i;
+ int error = 0;
(void)URL; /* not used */
- for(i = 0; dates[i]; i++) {
- printf("%d: %s => %ld\n", i, dates[i], (long)curl_getdate(dates[i], NULL));
+ for(i = 0; dates[i].input; i++) {
+ time_t out = curl_getdate(dates[i].input, NULL);
+ if(out != dates[i].output) {
+ printf("WRONGLY %s => %ld (instead of %ld)\n",
+ dates[i].input, out, dates[i].output);
+ error++;
+ }
}
- return 0;
+ return error;
}