/* $Id$ */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
+#define HTTP_WANT_SAPI
#define HTTP_WANT_CURL
#define HTTP_WANT_ZLIB
#define HTTP_WANT_MAGIC
#include "php_http.h"
-#include "SAPI.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "zend_extensions.h"
static inline void _http_globals_init(zend_http_globals *G TSRMLS_DC)
{
G->send.buffer_size = HTTP_SENDBUF_SIZE;
+#ifndef HTTP_HAVE_SAPI_RTIME
+ G->request_time = time(NULL);
+#endif
}
#define http_globals_free(g) _http_globals_free((g) TSRMLS_CC)
/* {{{ PHP_RINIT_FUNCTION */
PHP_RINIT_FUNCTION(http)
{
+ http_globals_init(HTTP_GLOBALS);
+
if (HTTP_G(request).methods.allowed) {
http_check_allowed_methods(HTTP_G(request).methods.allowed,
strlen(HTTP_G(request).methods.allowed));
}
- http_globals_init(HTTP_GLOBALS);
-
if ( (SUCCESS != PHP_RINIT_CALL(http_request_method))
#ifdef HTTP_HAVE_ZLIB
|| (SUCCESS != PHP_RINIT_CALL(http_encoding))
/* $Id$ */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
+#define HTTP_WANT_SAPI
#include "php_http.h"
-#include "SAPI.h"
#include "php_output.h"
#include "ext/standard/url.h"
struct tm nowtm;
char datetime[20] = {0};
- time(&now);
+ now = HTTP_GET_REQUEST_TIME();
strftime(datetime, sizeof(datetime), "%Y-%m-%d %H:%M:%S", php_localtime_r(&now, &nowtm));
#define HTTP_LOG_WRITE(file, type, msg) \
/* $Id$ */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
+#define HTTP_WANT_SAPI
#include "php_http.h"
-#include "SAPI.h"
#include "php_output.h"
#include "php_streams.h"
switch (data_mode)
{
- case SEND_DATA: return time(NULL);
+ case SEND_DATA: return HTTP_GET_REQUEST_TIME();
case SEND_RSRC: return php_stream_stat((php_stream *) data_ptr, &ssb) ? 0 : ssb.sb.st_mtime;
default: return php_stream_stat_path((char *) data_ptr, &ssb) ? 0 : ssb.sb.st_mtime;
}
/* $Id$ */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include "php_http.h"
+
#include "php_http_api.h"
#include "php_http_date_api.h"
/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#define HTTP_WANT_ZLIB
#include "php_http.h"
/* $Id$ */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#define HTTP_WANT_ZLIB
#include "php_http.h"
/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include "php_http.h"
#ifdef ZEND_ENGINE_2
/* $Id$ */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#define HTTP_WANT_ZLIB
#include "php_http.h"
/* $Id$ */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
+#define HTTP_WANT_SAPI
#define HTTP_WANT_CURL
#define HTTP_WANT_ZLIB
#include "php_http.h"
-#include "SAPI.h"
#include "php_ini.h"
-#include "ext/standard/info.h"
#include "ext/standard/php_string.h"
#include "zend_operators.h"
}
if (t == -1) {
- t = (long) time(NULL);
+ t = (long) HTTP_GET_REQUEST_TIME();
}
RETURN_STRING(http_date(t), 0);
}
if (t == -1) {
- t = (long) time(NULL);
+ t = (long) HTTP_GET_REQUEST_TIME();
}
RETURN_SUCCESS(http_send_last_modified(t));
// current time if not supplied (senseless though)
if (t == -1) {
- t = (long) time(NULL);
+ t = (long) HTTP_GET_REQUEST_TIME();
}
if (for_range) {
HTTP_CHECK_HEADERS_SENT(RETURN_FALSE);
- t = (long) time(NULL);
+ t = (long) HTTP_GET_REQUEST_TIME();
/* 0 or omitted */
if (!last_modified) {
/* $Id$ */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include "php_http.h"
#include "ext/standard/url.h"
/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#define HTTP_WANT_ZLIB
#include "php_http.h"
/* $Id$ */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include "php_http.h"
#include "php_http_api.h"
/* $Id$ */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
+#define HTTP_WANT_SAPI
#define HTTP_WANT_CURL
#define HTTP_WANT_ZLIB
#include "php_http.h"
-#include "SAPI.h"
-
#include "php_http_api.h"
#include "php_http_encoding_api.h"
#include "php_http_headers_api.h"
/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include "php_http.h"
#ifdef ZEND_ENGINE_2
/* $Id$ */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
+#define HTTP_WANT_SAPI
#define HTTP_WANT_CURL
#include "php_http.h"
if (Z_LVAL_P(zoption) > 0) {
HTTP_CURL_OPT(TIMEVALUE, Z_LVAL_P(zoption));
} else {
- HTTP_CURL_OPT(TIMEVALUE, time(NULL) + Z_LVAL_P(zoption));
+ HTTP_CURL_OPT(TIMEVALUE, HTTP_GET_REQUEST_TIME() + Z_LVAL_P(zoption));
}
HTTP_CURL_OPT(TIMECONDITION, range_req ? CURL_TIMECOND_IFUNMODSINCE : CURL_TIMECOND_IFMODSINCE);
} else {
/* $Id$ */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#define HTTP_WANT_CURL
#include "php_http.h"
/* $Id$ */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#define HTTP_WANT_CURL
#include "php_http.h"
/* $Id$ */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#define HTTP_WANT_CURL
#include "php_http.h"
/* $Id$ */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#define HTTP_WANT_CURL
#include "php_http.h"
/* $Id$ */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#define HTTP_WANT_CURL
#include "php_http.h"
/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
+#define HTTP_WANT_SAPI
#define HTTP_WANT_MAGIC
#include "php_http.h"
/* broken static properties in PHP 5.0 */
#if defined(ZEND_ENGINE_2) && !defined(WONKY)
-#include "SAPI.h"
#include "php_ini.h"
#include "php_http_api.h"
cctl = convert_to_type_ex(IS_STRING, GET_STATIC_PROP(cacheControl), &cctl_p);
http_cache_etag(Z_STRVAL_P(etag), Z_STRLEN_P(etag), Z_STRVAL_P(cctl), Z_STRLEN_P(cctl));
- http_cache_last_modified(Z_LVAL_P(lmod), Z_LVAL_P(lmod) ? Z_LVAL_P(lmod) : time(NULL), Z_STRVAL_P(cctl), Z_STRLEN_P(cctl));
+ http_cache_last_modified(Z_LVAL_P(lmod), Z_LVAL_P(lmod) ? Z_LVAL_P(lmod) : HTTP_GET_REQUEST_TIME(), Z_STRVAL_P(cctl), Z_STRLEN_P(cctl));
if (etag_p) zval_ptr_dtor(&etag_p);
if (lmod_p) zval_ptr_dtor(&lmod_p);
/* $Id$ */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
+#define HTTP_WANT_SAPI
#define HTTP_WANT_ZLIB
#define HTTP_WANT_MAGIC
#include "php_http.h"
-#include "SAPI.h"
#include "php_streams.h"
#include "ext/standard/php_lcg.h"
char boundary_str[32], range_header_str[256];
size_t boundary_len, range_header_len;
- boundary_len = snprintf(boundary_str, lenof(boundary_str), "%lu%0.9f", (ulong) time(NULL), (float) php_combined_lcg(TSRMLS_C));
+ boundary_len = snprintf(boundary_str, lenof(boundary_str), "%lu%0.9f", (ulong) HTTP_GET_REQUEST_TIME(), (float) php_combined_lcg(TSRMLS_C));
range_header_len = snprintf(range_header_str, lenof(range_header_str), "Content-Type: multipart/byteranges; boundary=%s", boundary_str);
http_send_status_header_ex(206, range_header_str, range_header_len, 1);
/* $Id$ */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
+#define HTTP_WANT_SAPI
#define HTTP_WANT_NETDB
#include "php_http.h"
-#include "SAPI.h"
#include "zend_ini.h"
#include "php_output.h"
#include "ext/standard/php_string.h"
/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include "php_http.h"
#ifdef ZEND_ENGINE_2
/* $Id$ */
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#else
+# include "php_config.h"
+#endif
+
#include "php.h"
#include "missing.h"
#define PHP_EXT_HTTP_VERSION "0.22.0-dev"
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#else
+# include "php_config.h"
+#endif
+
#include "php.h"
#include "php_http_std_defs.h"
#include "phpstr/phpstr.h"
#include "missing.h"
+#ifdef HTTP_WANT_SAPI
+# if PHP_API_VERSION > 20041225
+# define HTTP_HAVE_SAPI_RTIME
+# define HTTP_GET_REQUEST_TIME() sapi_get_request_time(TSRMLS_C)
+# else
+# define HTTP_GET_REQUEST_TIME() HTTP_G(request_time)
+# endif
+# include "SAPI.h"
+#endif
+
#ifdef HTTP_WANT_NETDB
# ifdef PHP_WIN32
# define HTTP_HAVE_NETDB
} methods;
} request;
+#ifndef HTTP_HAVE_SAPI_RTIME
+ time_t request_time;
+#endif
#ifdef ZEND_ENGINE_2
zend_bool only_exceptions;
#endif
#define http_etag_digest(d, l) _http_etag_digest((d), (l))
static inline char *_http_etag_digest(const unsigned char *digest, int len)
{
- static const char hexdigits[16] = "0123456789abcdef";
+ static const char hexdigits[17] = "0123456789abcdef";
int i;
char *hex = emalloc(len * 2 + 1);
char *ptr = hex;