lib517.c 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /***************************************************************************
  2. * _ _ ____ _
  3. * Project ___| | | | _ \| |
  4. * / __| | | | |_) | |
  5. * | (__| |_| | _ <| |___
  6. * \___|\___/|_| \_\_____|
  7. *
  8. * Copyright (C) 1998 - 2011, 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 http://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. #include "memdebug.h"
  24. static const char * const dates[]={
  25. "Sun, 06 Nov 1994 08:49:37 GMT",
  26. "Sunday, 06-Nov-94 08:49:37 GMT",
  27. "Sun Nov 6 08:49:37 1994",
  28. "06 Nov 1994 08:49:37 GMT",
  29. "06-Nov-94 08:49:37 GMT",
  30. "Nov 6 08:49:37 1994",
  31. "06 Nov 1994 08:49:37",
  32. "06-Nov-94 08:49:37",
  33. "1994 Nov 6 08:49:37",
  34. "GMT 08:49:37 06-Nov-94 Sunday",
  35. "94 6 Nov 08:49:37",
  36. "1994 Nov 6",
  37. "06-Nov-94",
  38. "Sun Nov 6 94",
  39. "1994.Nov.6",
  40. "Sun/Nov/6/94/GMT",
  41. "Sun, 06 Nov 1994 08:49:37 CET",
  42. "06 Nov 1994 08:49:37 EST",
  43. "Sun, 12 Sep 2004 15:05:58 -0700",
  44. "Sat, 11 Sep 2004 21:32:11 +0200",
  45. "20040912 15:05:58 -0700",
  46. "20040911 +0200",
  47. "Thu, 01-Jan-1970 00:59:59 GMT",
  48. "Thu, 01-Jan-1970 01:00:00 GMT",
  49. /* "2094 Nov 6", See ../data/test517 for details */
  50. "Sat, 15-Apr-17 21:01:22 GMT",
  51. "Thu, 19-Apr-2007 16:00:00 GMT",
  52. "Wed, 25 Apr 2007 21:02:13 GMT",
  53. "Thu, 19/Apr\\2007 16:00:00 GMT",
  54. "Fri, 1 Jan 2010 01:01:50 GMT",
  55. "Wednesday, 1-Jan-2003 00:00:00 GMT",
  56. ", 1-Jan-2003 00:00:00 GMT",
  57. " 1-Jan-2003 00:00:00 GMT",
  58. "1-Jan-2003 00:00:00 GMT",
  59. "Wed,18-Apr-07 22:50:12 GMT",
  60. "WillyWonka , 18-Apr-07 22:50:12 GMT",
  61. "WillyWonka , 18-Apr-07 22:50:12",
  62. "WillyWonka , 18-apr-07 22:50:12",
  63. "Mon, 18-Apr-1977 22:50:13 GMT",
  64. "Mon, 18-Apr-77 22:50:13 GMT",
  65. "\"Sat, 15-Apr-17\\\"21:01:22\\\"GMT\"",
  66. "Partyday, 18- April-07 22:50:12",
  67. "Partyday, 18 - Apri-07 22:50:12",
  68. "Wednes, 1-Januar-2003 00:00:00 GMT",
  69. "Sat, 15-Apr-17 21:01:22",
  70. "Sat, 15-Apr-17 21:01:22 GMT-2",
  71. "Sat, 15-Apr-17 21:01:22 GMT BLAH",
  72. "Sat, 15-Apr-17 21:01:22 GMT-0400",
  73. "Sat, 15-Apr-17 21:01:22 GMT-0400 (EDT)",
  74. "Sat, 15-Apr-17 21:01:22 DST",
  75. "Sat, 15-Apr-17 21:01:22 -0400",
  76. "Sat, 15-Apr-17 21:01:22 (hello there)",
  77. "Sat, 15-Apr-17 21:01:22 11:22:33",
  78. "Sat, 15-Apr-17 ::00 21:01:22",
  79. "Sat, 15-Apr-17 boink:z 21:01:22",
  80. "Sat, 15-Apr-17 91:22:33 21:01:22",
  81. "Thu Apr 18 22:50:12 2007 GMT",
  82. "22:50:12 Thu Apr 18 2007 GMT",
  83. "Thu 22:50:12 Apr 18 2007 GMT",
  84. "Thu Apr 22:50:12 18 2007 GMT",
  85. "Thu Apr 18 22:50:12 2007 GMT",
  86. "Thu Apr 18 2007 22:50:12 GMT",
  87. "Thu Apr 18 2007 GMT 22:50:12",
  88. "Sat, 15-Apr-17 21:01:22 GMT",
  89. "15-Sat, Apr-17 21:01:22 GMT",
  90. "15-Sat, Apr 21:01:22 GMT 17",
  91. "15-Sat, Apr 21:01:22 GMT 2017",
  92. "15 Apr 21:01:22 2017",
  93. "15 17 Apr 21:01:22",
  94. "Apr 15 17 21:01:22",
  95. "Apr 15 21:01:22 17",
  96. "2017 April 15 21:01:22",
  97. "15 April 2017 21:01:22",
  98. "98 April 17 21:01:22",
  99. "Thu, 012-Aug-2008 20:49:07 GMT",
  100. #if 0
  101. /* leaving out these strings since they differ between 32 and 64 bit
  102. archs and the test suite has no good way to support two different outputs
  103. like that */
  104. "Thu, 12-Aug-31841 20:49:07 GMT",
  105. "Thu, 12-Aug-9999999999 20:49:07 GMT",
  106. #endif
  107. "Thu, 999999999999-Aug-2007 20:49:07 GMT",
  108. "Thu, 12-Aug-2007 20:61:99999999999 GMT",
  109. "IAintNoDateFool",
  110. "Thu Apr 18 22:50 2007 GMT", /* without seconds */
  111. "20110623 12:34:56",
  112. "20110632 12:34:56",
  113. "20110623 56:34:56",
  114. "20111323 12:34:56",
  115. "20110623 12:34:79",
  116. "Wed, 31 Dec 2008 23:59:60 GMT", /* leap second */
  117. NULL
  118. };
  119. int test(char *URL)
  120. {
  121. int i;
  122. (void)URL; /* not used */
  123. for(i=0; dates[i]; i++) {
  124. printf("%d: %s => %ld\n", i, dates[i], (long)curl_getdate(dates[i], NULL));
  125. }
  126. return 0;
  127. }