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.
This commit is contained in:
Daniel Stenberg 2005-02-11 00:03:49 +00:00
parent d2485e4f20
commit e7cefd684b
8 changed files with 78 additions and 28 deletions

View file

@ -87,6 +87,7 @@
#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>
@ -321,7 +322,6 @@ CURLcode Curl_file(struct connectdata *conn, bool *done)
if(result)
return result;
#ifdef HAVE_STRFTIME
if(fstated) {
struct tm *tm;
time_t clock = (time_t)statbuf.st_mtime;
@ -332,11 +332,17 @@ CURLcode Curl_file(struct connectdata *conn, bool *done)
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;
}