X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http_date_api.c;fp=http_date_api.c;h=e750a4da49863cec0d1077bd580ba5073dd84309;hp=66033262bbc3ba5f73e3bb7a0d1b951aaaf0e87a;hb=b51b3809f61db4904df3b9c034bbde879732f0b9;hpb=296a53ce9afb85164c2318e26e7d90b2c651d732 diff --git a/http_date_api.c b/http_date_api.c index 6603326..e750a4d 100644 --- a/http_date_api.c +++ b/http_date_api.c @@ -141,20 +141,19 @@ static inline int check_tzone(const char *tzone) /* {{{ char *http_date(time_t) */ PHP_HTTP_API char *_http_date(time_t t TSRMLS_DC) { + char *date = NULL; struct tm *gmtime, tmbuf; if ((gmtime = php_gmtime_r(&t, &tmbuf))) { - char *date = ecalloc(1, 31); - snprintf(date, 30, + spprintf(&date, 0, "%s, %02d %s %04d %02d:%02d:%02d GMT", days[gmtime->tm_wday], gmtime->tm_mday, months[gmtime->tm_mon], gmtime->tm_year + 1900, gmtime->tm_hour, gmtime->tm_min, gmtime->tm_sec ); - return date; } - return NULL; + return date; } /* }}} */