week day names and month names and servers don't like that.
Changelog
+Daniel (11 February 2005)
+- Removed all uses of strftime() since it uses the localised version of the
+ week day names and month names and servers don't like that.
+
Daniel (10 February 2005)
- Now the test script disables valgrind-testing when the test suite runs if
libcurl is built shared. Otherwise valgrind only tests the shell that runs
o inflate buffer usage bugfix
o better DICT protocol adherence
o disable valgrind-checking while testing if libcurl is built shared
+ o locale names in some date strings
Other curl-related news since the previous public release:
- o
+ o pycurl 7.13.0: http://pycurl.sf.net/
This release would not have looked like this without help, code, reports and
advice from friends like these:
http_chunks.h strtok.h connect.h llist.h hash.h content_encoding.h \
share.h md5.h http_digest.h http_negotiate.h http_ntlm.h ca-bundle.h \
inet_pton.h strtoofft.h strerror.h inet_ntop.h curlx.h memory.h \
- setup.h transfer.h select.h easyif.h multiif.h
+ setup.h transfer.h select.h easyif.h multiif.h parsedate.h
#include "transfer.h"
#include "url.h"
#include "memory.h"
+#include "parsedate.h" /* for the week day and month names */
#define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h>
if(result)
return result;
-#ifdef HAVE_STRFTIME
if(fstated) {
struct tm *tm;
time_t clock = (time_t)statbuf.st_mtime;
tm = gmtime(&clock);
#endif
/* format: "Tue, 15 Nov 1994 12:45:26 GMT" */
- strftime(buf, BUFSIZE-1, "Last-Modified: %a, %d %b %Y %H:%M:%S GMT\r\n",
- tm);
+ snprintf(buf, BUFSIZE-1,
+ "Last-Modified: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n",
+ Curl_wkday[tm->tm_wday?tm->tm_wday-1:6],
+ tm->tm_mday,
+ Curl_month[tm->tm_mon],
+ tm->tm_year + 1900,
+ tm->tm_hour,
+ tm->tm_min,
+ tm->tm_sec);
result = Curl_client_write(data, CLIENTWRITE_BOTH, buf, 0);
}
-#endif
return result;
}
#include "memory.h"
#include "inet_ntop.h"
#include "select.h"
+#include "parsedate.h" /* for the week day and month names */
#if defined(HAVE_INET_NTOA_R) && !defined(HAVE_INET_NTOA_R_DECL)
#include "inet_ntoa_r.h"
/* If we asked for a time of the file and we actually got one as well,
we "emulate" a HTTP-style header in our output. */
-#ifdef HAVE_STRFTIME
if(data->set.get_filetime && (data->info.filetime>=0) ) {
struct tm *tm;
time_t clock = (time_t)data->info.filetime;
tm = gmtime(&clock);
#endif
/* format: "Tue, 15 Nov 1994 12:45:26" */
- strftime(buf, BUFSIZE-1,
- "Last-Modified: %a, %d %b %Y %H:%M:%S GMT\r\n", tm);
+ snprintf(buf, BUFSIZE-1,
+ "Last-Modified: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n",
+ Curl_wkday[tm->tm_wday?tm->tm_wday-1:6],
+ tm->tm_mday,
+ Curl_month[tm->tm_mon],
+ tm->tm_year + 1900,
+ tm->tm_hour,
+ tm->tm_min,
+ tm->tm_sec);
result = Curl_client_write(data, CLIENTWRITE_BOTH, buf, 0);
if(result)
return result;
}
-#endif
}
break;
default:
#include "http.h"
#include "memory.h"
#include "select.h"
+#include "parsedate.h" /* for the week day and month names */
#define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h>
#endif
if(data->set.timecondition) {
- struct tm *thistime;
+ struct tm *tm;
/* Phil Karn (Fri, 13 Apr 2001) pointed out that the If-Modified-Since
* header family should have their times set in GMT as RFC2616 defines:
#ifdef HAVE_GMTIME_R
/* thread-safe version */
struct tm keeptime;
- thistime = (struct tm *)gmtime_r(&data->set.timevalue, &keeptime);
+ tm = (struct tm *)gmtime_r(&data->set.timevalue, &keeptime);
#else
- thistime = gmtime(&data->set.timevalue);
+ tm = gmtime(&data->set.timevalue);
#endif
-#ifdef HAVE_STRFTIME
/* format: "Tue, 15 Nov 1994 12:45:26 GMT" */
- strftime(buf, BUFSIZE-1, "%a, %d %b %Y %H:%M:%S GMT", thistime);
-#else
- /* TODO: Right, we *could* write a replacement here */
- strcpy(buf, "no strftime() support");
-#endif
+ snprintf(buf, BUFSIZE-1,
+ "%s, %02d %s %4d %02d:%02d:%02d GMT",
+ Curl_wkday[tm->tm_wday?tm->tm_wday-1:6],
+ tm->tm_mday,
+ Curl_month[tm->tm_mon],
+ tm->tm_year + 1900,
+ tm->tm_hour,
+ tm->tm_min,
+ tm->tm_sec);
+
switch(data->set.timecondition) {
case CURL_TIMECOND_IFMODSINCE:
default:
static time_t Curl_parsedate(const char *date);
-static const char * const wkday[] =
- {"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"};
+const char * const Curl_wkday[] =
+{"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"};
static const char * const weekday[] =
- { "Monday", "Tuesday", "Wednesday", "Thursday",
- "Friday", "Saturday", "Sunday" };
-static const char * const month[]=
- { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
+{ "Monday", "Tuesday", "Wednesday", "Thursday",
+ "Friday", "Saturday", "Sunday" };
+const char * const Curl_month[]=
+{ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
struct tzinfo {
const char *name;
if(len > 3)
what = &weekday[0];
else
- what = &wkday[0];
+ what = &Curl_wkday[0];
for(i=0; i<7; i++) {
if(curl_strequal(check, what[0])) {
found=TRUE;
const char * const *what;
bool found= FALSE;
- what = &month[0];
+ what = &Curl_month[0];
for(i=0; i<12; i++) {
if(curl_strequal(check, what[0])) {
found=TRUE;
--- /dev/null
+#ifndef __PARSEDATE_H
+#define __PARSEDATEL_H
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2004, 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
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ * $Id$
+ ***************************************************************************/
+extern const char * const Curl_wkday[7];
+extern const char * const Curl_month[12];
+
+#endif