lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | /*************************************************************************** |
| 2 | * _ _ ____ _ |
| 3 | * Project ___| | | | _ \| | |
| 4 | * / __| | | | |_) | | |
| 5 | * | (__| |_| | _ <| |___ |
| 6 | * \___|\___/|_| \_\_____| |
| 7 | * |
| 8 | * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. |
| 9 | * |
| 10 | * This software is licensed as described in the file COPYING, which |
| 11 | * you should have received as part of this distribution. The terms |
| 12 | * are also available at https://curl.haxx.se/docs/copyright.html. |
| 13 | * |
| 14 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell |
| 15 | * copies of the Software, and permit persons to whom the Software is |
| 16 | * furnished to do so, under the terms of the COPYING file. |
| 17 | * |
| 18 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 19 | * KIND, either express or implied. |
| 20 | * |
| 21 | ***************************************************************************/ |
| 22 | #include "test.h" |
| 23 | |
| 24 | #include "memdebug.h" |
| 25 | |
| 26 | static const char * const dates[]={ |
| 27 | "Sun, 06 Nov 1994 08:49:37 GMT", |
| 28 | "Sunday, 06-Nov-94 08:49:37 GMT", |
| 29 | "Sun Nov 6 08:49:37 1994", |
| 30 | "06 Nov 1994 08:49:37 GMT", |
| 31 | "06-Nov-94 08:49:37 GMT", |
| 32 | "Nov 6 08:49:37 1994", |
| 33 | "06 Nov 1994 08:49:37", |
| 34 | "06-Nov-94 08:49:37", |
| 35 | "1994 Nov 6 08:49:37", |
| 36 | "GMT 08:49:37 06-Nov-94 Sunday", |
| 37 | "94 6 Nov 08:49:37", |
| 38 | "1994 Nov 6", |
| 39 | "06-Nov-94", |
| 40 | "Sun Nov 6 94", |
| 41 | "1994.Nov.6", |
| 42 | "Sun/Nov/6/94/GMT", |
| 43 | "Sun, 06 Nov 1994 08:49:37 CET", |
| 44 | "06 Nov 1994 08:49:37 EST", |
| 45 | "Sun, 12 Sep 2004 15:05:58 -0700", |
| 46 | "Sat, 11 Sep 2004 21:32:11 +0200", |
| 47 | "20040912 15:05:58 -0700", |
| 48 | "20040911 +0200", |
| 49 | "Thu, 01-Jan-1970 00:59:59 GMT", |
| 50 | "Thu, 01-Jan-1970 01:00:00 GMT", |
| 51 | /* "2094 Nov 6", See ../data/test517 for details */ |
| 52 | "Sat, 15-Apr-17 21:01:22 GMT", |
| 53 | "Thu, 19-Apr-2007 16:00:00 GMT", |
| 54 | "Wed, 25 Apr 2007 21:02:13 GMT", |
| 55 | "Thu, 19/Apr\\2007 16:00:00 GMT", |
| 56 | "Fri, 1 Jan 2010 01:01:50 GMT", |
| 57 | "Wednesday, 1-Jan-2003 00:00:00 GMT", |
| 58 | ", 1-Jan-2003 00:00:00 GMT", |
| 59 | " 1-Jan-2003 00:00:00 GMT", |
| 60 | "1-Jan-2003 00:00:00 GMT", |
| 61 | "Wed,18-Apr-07 22:50:12 GMT", |
| 62 | "WillyWonka , 18-Apr-07 22:50:12 GMT", |
| 63 | "WillyWonka , 18-Apr-07 22:50:12", |
| 64 | "WillyWonka , 18-apr-07 22:50:12", |
| 65 | "Mon, 18-Apr-1977 22:50:13 GMT", |
| 66 | "Mon, 18-Apr-77 22:50:13 GMT", |
| 67 | "\"Sat, 15-Apr-17\\\"21:01:22\\\"GMT\"", |
| 68 | "Partyday, 18- April-07 22:50:12", |
| 69 | "Partyday, 18 - Apri-07 22:50:12", |
| 70 | "Wednes, 1-Januar-2003 00:00:00 GMT", |
| 71 | "Sat, 15-Apr-17 21:01:22", |
| 72 | "Sat, 15-Apr-17 21:01:22 GMT-2", |
| 73 | "Sat, 15-Apr-17 21:01:22 GMT BLAH", |
| 74 | "Sat, 15-Apr-17 21:01:22 GMT-0400", |
| 75 | "Sat, 15-Apr-17 21:01:22 GMT-0400 (EDT)", |
| 76 | "Sat, 15-Apr-17 21:01:22 DST", |
| 77 | "Sat, 15-Apr-17 21:01:22 -0400", |
| 78 | "Sat, 15-Apr-17 21:01:22 (hello there)", |
| 79 | "Sat, 15-Apr-17 21:01:22 11:22:33", |
| 80 | "Sat, 15-Apr-17 ::00 21:01:22", |
| 81 | "Sat, 15-Apr-17 boink:z 21:01:22", |
| 82 | "Sat, 15-Apr-17 91:22:33 21:01:22", |
| 83 | "Thu Apr 18 22:50:12 2007 GMT", |
| 84 | "22:50:12 Thu Apr 18 2007 GMT", |
| 85 | "Thu 22:50:12 Apr 18 2007 GMT", |
| 86 | "Thu Apr 22:50:12 18 2007 GMT", |
| 87 | "Thu Apr 18 22:50:12 2007 GMT", |
| 88 | "Thu Apr 18 2007 22:50:12 GMT", |
| 89 | "Thu Apr 18 2007 GMT 22:50:12", |
| 90 | "Sat, 15-Apr-17 21:01:22 GMT", |
| 91 | "15-Sat, Apr-17 21:01:22 GMT", |
| 92 | "15-Sat, Apr 21:01:22 GMT 17", |
| 93 | "15-Sat, Apr 21:01:22 GMT 2017", |
| 94 | "15 Apr 21:01:22 2017", |
| 95 | "15 17 Apr 21:01:22", |
| 96 | "Apr 15 17 21:01:22", |
| 97 | "Apr 15 21:01:22 17", |
| 98 | "2017 April 15 21:01:22", |
| 99 | "15 April 2017 21:01:22", |
| 100 | "98 April 17 21:01:22", |
| 101 | "Thu, 012-Aug-2008 20:49:07 GMT", |
| 102 | #if 0 |
| 103 | /* leaving out these strings since they differ between 32 and 64 bit |
| 104 | archs and the test suite has no good way to support two different outputs |
| 105 | like that */ |
| 106 | "Thu, 12-Aug-31841 20:49:07 GMT", |
| 107 | "Thu, 12-Aug-9999999999 20:49:07 GMT", |
| 108 | #endif |
| 109 | "Thu, 999999999999-Aug-2007 20:49:07 GMT", |
| 110 | "Thu, 12-Aug-2007 20:61:99999999999 GMT", |
| 111 | "IAintNoDateFool", |
| 112 | "Thu Apr 18 22:50 2007 GMT", /* without seconds */ |
| 113 | "20110623 12:34:56", |
| 114 | "20110632 12:34:56", |
| 115 | "20110623 56:34:56", |
| 116 | "20111323 12:34:56", |
| 117 | "20110623 12:34:79", |
| 118 | "Wed, 31 Dec 2008 23:59:60 GMT", /* leap second */ |
| 119 | "20110623 12:3", |
| 120 | "20110623 1:3", |
| 121 | "20110623 1:30", |
| 122 | "20110623 12:12:3", |
| 123 | "20110623 01:12:3", |
| 124 | "20110623 01:99:30", |
| 125 | NULL |
| 126 | }; |
| 127 | |
| 128 | int test(char *URL) |
| 129 | { |
| 130 | int i; |
| 131 | |
| 132 | (void)URL; /* not used */ |
| 133 | |
| 134 | for(i=0; dates[i]; i++) { |
| 135 | printf("%d: %s => %ld\n", i, dates[i], (long)curl_getdate(dates[i], NULL)); |
| 136 | } |
| 137 | |
| 138 | return 0; |
| 139 | } |