mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
parent
49b10ee264
commit
cf0397ef06
3 changed files with 55 additions and 66 deletions
|
@ -347,23 +347,23 @@ static void fcgi_setup_signals(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FCGI_API void fcgi_set_in_shutdown(int new_value)
|
void fcgi_set_in_shutdown(int new_value)
|
||||||
{
|
{
|
||||||
in_shutdown = new_value;
|
in_shutdown = new_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
FCGI_API int fcgi_in_shutdown(void)
|
int fcgi_in_shutdown(void)
|
||||||
{
|
{
|
||||||
return in_shutdown;
|
return in_shutdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
FCGI_API void fcgi_terminate(void)
|
void fcgi_terminate(void)
|
||||||
{
|
{
|
||||||
in_shutdown = 1;
|
in_shutdown = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HAVE_ATTRIBUTE_WEAK
|
#ifndef HAVE_ATTRIBUTE_WEAK
|
||||||
FCGI_API void fcgi_set_logger(fcgi_logger lg) {
|
void fcgi_set_logger(fcgi_logger lg) {
|
||||||
fcgi_log = lg;
|
fcgi_log = lg;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -376,7 +376,7 @@ void __attribute__((weak)) fcgi_log(int type, const char *format, ...) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FCGI_API int fcgi_init(void)
|
int fcgi_init(void)
|
||||||
{
|
{
|
||||||
if (!is_initialized) {
|
if (!is_initialized) {
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
@ -442,7 +442,7 @@ FCGI_API int fcgi_init(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FCGI_API int fcgi_is_fastcgi(void)
|
int fcgi_is_fastcgi(void)
|
||||||
{
|
{
|
||||||
if (!is_initialized) {
|
if (!is_initialized) {
|
||||||
return fcgi_init();
|
return fcgi_init();
|
||||||
|
@ -451,7 +451,7 @@ FCGI_API int fcgi_is_fastcgi(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FCGI_API void fcgi_shutdown(void)
|
void fcgi_shutdown(void)
|
||||||
{
|
{
|
||||||
if (is_initialized) {
|
if (is_initialized) {
|
||||||
zend_hash_destroy(&fcgi_mgmt_vars);
|
zend_hash_destroy(&fcgi_mgmt_vars);
|
||||||
|
@ -543,7 +543,7 @@ static int is_port_number(const char *bindpath)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
FCGI_API int fcgi_listen(const char *path, int backlog)
|
int fcgi_listen(const char *path, int backlog)
|
||||||
{
|
{
|
||||||
char *s;
|
char *s;
|
||||||
int tcp = 0;
|
int tcp = 0;
|
||||||
|
@ -723,7 +723,7 @@ FCGI_API int fcgi_listen(const char *path, int backlog)
|
||||||
return listen_socket;
|
return listen_socket;
|
||||||
}
|
}
|
||||||
|
|
||||||
FCGI_API void fcgi_set_allowed_clients(char *ip)
|
void fcgi_set_allowed_clients(char *ip)
|
||||||
{
|
{
|
||||||
char *cur, *end;
|
char *cur, *end;
|
||||||
int n;
|
int n;
|
||||||
|
@ -772,7 +772,7 @@ static void fcgi_hook_dummy() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FCGI_API fcgi_request *fcgi_init_request(fcgi_request *req, int listen_socket)
|
fcgi_request *fcgi_init_request(fcgi_request *req, int listen_socket)
|
||||||
{
|
{
|
||||||
memset(req, 0, sizeof(fcgi_request));
|
memset(req, 0, sizeof(fcgi_request));
|
||||||
req->listen_socket = listen_socket;
|
req->listen_socket = listen_socket;
|
||||||
|
@ -807,7 +807,7 @@ FCGI_API fcgi_request *fcgi_init_request(fcgi_request *req, int listen_socket)
|
||||||
return req;
|
return req;
|
||||||
}
|
}
|
||||||
|
|
||||||
FCGI_API void fcgi_destroy_request(fcgi_request *req) {
|
void fcgi_destroy_request(fcgi_request *req) {
|
||||||
fcgi_hash_destroy(&req->env);
|
fcgi_hash_destroy(&req->env);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1099,7 +1099,7 @@ static int fcgi_read_request(fcgi_request *req)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
FCGI_API int fcgi_read(fcgi_request *req, char *str, int len)
|
int fcgi_read(fcgi_request *req, char *str, int len)
|
||||||
{
|
{
|
||||||
int ret, n, rest;
|
int ret, n, rest;
|
||||||
fcgi_header hdr;
|
fcgi_header hdr;
|
||||||
|
@ -1152,7 +1152,7 @@ FCGI_API int fcgi_read(fcgi_request *req, char *str, int len)
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
FCGI_API void fcgi_close(fcgi_request *req, int force, int destroy)
|
void fcgi_close(fcgi_request *req, int force, int destroy)
|
||||||
{
|
{
|
||||||
if (destroy && req->has_env) {
|
if (destroy && req->has_env) {
|
||||||
fcgi_hash_clean(&req->env);
|
fcgi_hash_clean(&req->env);
|
||||||
|
@ -1203,7 +1203,7 @@ FCGI_API void fcgi_close(fcgi_request *req, int force, int destroy)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FCGI_API int fcgi_is_closed(fcgi_request *req)
|
int fcgi_is_closed(fcgi_request *req)
|
||||||
{
|
{
|
||||||
return (req->fd < 0);
|
return (req->fd < 0);
|
||||||
}
|
}
|
||||||
|
@ -1246,7 +1246,7 @@ static int fcgi_is_allowed() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
FCGI_API int fcgi_accept_request(fcgi_request *req)
|
int fcgi_accept_request(fcgi_request *req)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
HANDLE pipe;
|
HANDLE pipe;
|
||||||
|
@ -1397,7 +1397,7 @@ static inline void close_packet(fcgi_request *req)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FCGI_API int fcgi_flush(fcgi_request *req, int close)
|
int fcgi_flush(fcgi_request *req, int close)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
|
@ -1427,7 +1427,7 @@ FCGI_API int fcgi_flush(fcgi_request *req, int close)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
FCGI_API int fcgi_write(fcgi_request *req, fcgi_request_type type, const char *str, int len)
|
int fcgi_write(fcgi_request *req, fcgi_request_type type, const char *str, int len)
|
||||||
{
|
{
|
||||||
int limit, rest;
|
int limit, rest;
|
||||||
|
|
||||||
|
@ -1539,7 +1539,7 @@ FCGI_API int fcgi_write(fcgi_request *req, fcgi_request_type type, const char *s
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
FCGI_API int fcgi_finish_request(fcgi_request *req, int force_close)
|
int fcgi_finish_request(fcgi_request *req, int force_close)
|
||||||
{
|
{
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
|
|
||||||
|
@ -1553,7 +1553,7 @@ FCGI_API int fcgi_finish_request(fcgi_request *req, int force_close)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
FCGI_API char* fcgi_getenv(fcgi_request *req, const char* var, int var_len)
|
char* fcgi_getenv(fcgi_request *req, const char* var, int var_len)
|
||||||
{
|
{
|
||||||
unsigned int val_len;
|
unsigned int val_len;
|
||||||
|
|
||||||
|
@ -1562,14 +1562,14 @@ FCGI_API char* fcgi_getenv(fcgi_request *req, const char* var, int var_len)
|
||||||
return fcgi_hash_get(&req->env, FCGI_HASH_FUNC(var, var_len), (char*)var, var_len, &val_len);
|
return fcgi_hash_get(&req->env, FCGI_HASH_FUNC(var, var_len), (char*)var, var_len, &val_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
FCGI_API char* fcgi_quick_getenv(fcgi_request *req, const char* var, int var_len, unsigned int hash_value)
|
char* fcgi_quick_getenv(fcgi_request *req, const char* var, int var_len, unsigned int hash_value)
|
||||||
{
|
{
|
||||||
unsigned int val_len;
|
unsigned int val_len;
|
||||||
|
|
||||||
return fcgi_hash_get(&req->env, hash_value, (char*)var, var_len, &val_len);
|
return fcgi_hash_get(&req->env, hash_value, (char*)var, var_len, &val_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
FCGI_API char* fcgi_putenv(fcgi_request *req, char* var, int var_len, char* val)
|
char* fcgi_putenv(fcgi_request *req, char* var, int var_len, char* val)
|
||||||
{
|
{
|
||||||
if (!req) return NULL;
|
if (!req) return NULL;
|
||||||
if (val == NULL) {
|
if (val == NULL) {
|
||||||
|
@ -1580,7 +1580,7 @@ FCGI_API char* fcgi_putenv(fcgi_request *req, char* var, int var_len, char* val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FCGI_API char* fcgi_quick_putenv(fcgi_request *req, char* var, int var_len, unsigned int hash_value, char* val)
|
char* fcgi_quick_putenv(fcgi_request *req, char* var, int var_len, unsigned int hash_value, char* val)
|
||||||
{
|
{
|
||||||
if (val == NULL) {
|
if (val == NULL) {
|
||||||
fcgi_hash_del(&req->env, hash_value, var, var_len);
|
fcgi_hash_del(&req->env, hash_value, var, var_len);
|
||||||
|
@ -1590,13 +1590,13 @@ FCGI_API char* fcgi_quick_putenv(fcgi_request *req, char* var, int var_len, unsi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FCGI_API void fcgi_loadenv(fcgi_request *req, fcgi_apply_func func, zval *array)
|
void fcgi_loadenv(fcgi_request *req, fcgi_apply_func func, zval *array)
|
||||||
{
|
{
|
||||||
fcgi_hash_apply(&req->env, func, array);
|
fcgi_hash_apply(&req->env, func, array);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
FCGI_API void fcgi_impersonate(void)
|
void fcgi_impersonate(void)
|
||||||
{
|
{
|
||||||
char *os_name;
|
char *os_name;
|
||||||
|
|
||||||
|
@ -1607,19 +1607,19 @@ FCGI_API void fcgi_impersonate(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FCGI_API void fcgi_set_mgmt_var(const char * name, size_t name_len, const char * value, size_t value_len)
|
void fcgi_set_mgmt_var(const char * name, size_t name_len, const char * value, size_t value_len)
|
||||||
{
|
{
|
||||||
zval zvalue;
|
zval zvalue;
|
||||||
ZVAL_NEW_STR(&zvalue, zend_string_init(value, value_len, 1));
|
ZVAL_NEW_STR(&zvalue, zend_string_init(value, value_len, 1));
|
||||||
zend_hash_str_add(&fcgi_mgmt_vars, name, name_len, &zvalue);
|
zend_hash_str_add(&fcgi_mgmt_vars, name, name_len, &zvalue);
|
||||||
}
|
}
|
||||||
|
|
||||||
FCGI_API void fcgi_free_mgmt_var_cb(zval *zv)
|
void fcgi_free_mgmt_var_cb(zval *zv)
|
||||||
{
|
{
|
||||||
pefree(Z_STR_P(zv), 1);
|
pefree(Z_STR_P(zv), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
FCGI_API const char *fcgi_get_last_client_ip()
|
const char *fcgi_get_last_client_ip()
|
||||||
{
|
{
|
||||||
static char str[INET6_ADDRSTRLEN];
|
static char str[INET6_ADDRSTRLEN];
|
||||||
|
|
||||||
|
|
|
@ -43,16 +43,6 @@
|
||||||
#define FCGI_PUTENV(request, name, value) \
|
#define FCGI_PUTENV(request, name, value) \
|
||||||
fcgi_quick_putenv(request, name, sizeof(name)-1, FCGI_HASH_FUNC(name, sizeof(name)-1), value)
|
fcgi_quick_putenv(request, name, sizeof(name)-1, FCGI_HASH_FUNC(name, sizeof(name)-1), value)
|
||||||
|
|
||||||
#ifdef PHP_WIN32
|
|
||||||
# ifdef FCGI_EXPORTS
|
|
||||||
# define FCGI_API __declspec(dllexport)
|
|
||||||
# else
|
|
||||||
# define FCGI_API __declspec(dllimport)
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
# define FCGI_API
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef enum _fcgi_role {
|
typedef enum _fcgi_role {
|
||||||
FCGI_RESPONDER = 1,
|
FCGI_RESPONDER = 1,
|
||||||
FCGI_AUTHORIZER = 2,
|
FCGI_AUTHORIZER = 2,
|
||||||
|
@ -196,44 +186,44 @@ struct _fcgi_request {
|
||||||
fcgi_hash env;
|
fcgi_hash env;
|
||||||
};
|
};
|
||||||
|
|
||||||
FCGI_API int fcgi_init(void);
|
int fcgi_init(void);
|
||||||
FCGI_API void fcgi_shutdown(void);
|
void fcgi_shutdown(void);
|
||||||
FCGI_API int fcgi_is_fastcgi(void);
|
int fcgi_is_fastcgi(void);
|
||||||
FCGI_API int fcgi_is_closed(fcgi_request *req);
|
int fcgi_is_closed(fcgi_request *req);
|
||||||
FCGI_API void fcgi_close(fcgi_request *req, int force, int destroy);
|
void fcgi_close(fcgi_request *req, int force, int destroy);
|
||||||
FCGI_API int fcgi_in_shutdown(void);
|
int fcgi_in_shutdown(void);
|
||||||
FCGI_API void fcgi_terminate(void);
|
void fcgi_terminate(void);
|
||||||
FCGI_API int fcgi_listen(const char *path, int backlog);
|
int fcgi_listen(const char *path, int backlog);
|
||||||
FCGI_API fcgi_request* fcgi_init_request(fcgi_request *request, int listen_socket);
|
fcgi_request* fcgi_init_request(fcgi_request *request, int listen_socket);
|
||||||
FCGI_API void fcgi_destroy_request(fcgi_request *req);
|
void fcgi_destroy_request(fcgi_request *req);
|
||||||
FCGI_API void fcgi_set_allowed_clients(char *ip);
|
void fcgi_set_allowed_clients(char *ip);
|
||||||
FCGI_API int fcgi_accept_request(fcgi_request *req);
|
int fcgi_accept_request(fcgi_request *req);
|
||||||
FCGI_API int fcgi_finish_request(fcgi_request *req, int force_close);
|
int fcgi_finish_request(fcgi_request *req, int force_close);
|
||||||
FCGI_API const char *fcgi_get_last_client_ip();
|
const char *fcgi_get_last_client_ip();
|
||||||
FCGI_API void fcgi_set_in_shutdown(int new_value);
|
void fcgi_set_in_shutdown(int new_value);
|
||||||
|
|
||||||
#ifndef HAVE_ATTRIBUTE_WEAK
|
#ifndef HAVE_ATTRIBUTE_WEAK
|
||||||
typedef void (*fcgi_logger)(int type, const char *fmt, ...);
|
typedef void (*fcgi_logger)(int type, const char *fmt, ...);
|
||||||
FCGI_API void fcgi_set_logger(fcgi_logger lg);
|
void fcgi_set_logger(fcgi_logger lg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FCGI_API char* fcgi_getenv(fcgi_request *req, const char* var, int var_len);
|
char* fcgi_getenv(fcgi_request *req, const char* var, int var_len);
|
||||||
FCGI_API char* fcgi_putenv(fcgi_request *req, char* var, int var_len, char* val);
|
char* fcgi_putenv(fcgi_request *req, char* var, int var_len, char* val);
|
||||||
FCGI_API char* fcgi_quick_getenv(fcgi_request *req, const char* var, int var_len, unsigned int hash_value);
|
char* fcgi_quick_getenv(fcgi_request *req, const char* var, int var_len, unsigned int hash_value);
|
||||||
FCGI_API char* fcgi_quick_putenv(fcgi_request *req, char* var, int var_len, unsigned int hash_value, char* val);
|
char* fcgi_quick_putenv(fcgi_request *req, char* var, int var_len, unsigned int hash_value, char* val);
|
||||||
FCGI_API void fcgi_loadenv(fcgi_request *req, fcgi_apply_func load_func, zval *array);
|
void fcgi_loadenv(fcgi_request *req, fcgi_apply_func load_func, zval *array);
|
||||||
|
|
||||||
FCGI_API int fcgi_read(fcgi_request *req, char *str, int len);
|
int fcgi_read(fcgi_request *req, char *str, int len);
|
||||||
|
|
||||||
FCGI_API int fcgi_write(fcgi_request *req, fcgi_request_type type, const char *str, int len);
|
int fcgi_write(fcgi_request *req, fcgi_request_type type, const char *str, int len);
|
||||||
FCGI_API int fcgi_flush(fcgi_request *req, int close);
|
int fcgi_flush(fcgi_request *req, int close);
|
||||||
|
|
||||||
#ifdef PHP_WIN32
|
#ifdef PHP_WIN32
|
||||||
FCGI_API void fcgi_impersonate(void);
|
void fcgi_impersonate(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FCGI_API void fcgi_set_mgmt_var(const char * name, size_t name_len, const char * value, size_t value_len);
|
void fcgi_set_mgmt_var(const char * name, size_t name_len, const char * value, size_t value_len);
|
||||||
FCGI_API void fcgi_free_mgmt_var_cb(zval *zv);
|
void fcgi_free_mgmt_var_cb(zval *zv);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Local variables:
|
* Local variables:
|
||||||
|
|
|
@ -2599,8 +2599,7 @@ function toolset_setup_common_cflags()
|
||||||
{
|
{
|
||||||
// CFLAGS for building the PHP dll
|
// CFLAGS for building the PHP dll
|
||||||
DEFINE("CFLAGS_PHP", "/D _USRDLL /D PHP7DLLTS_EXPORTS /D PHP_EXPORTS \
|
DEFINE("CFLAGS_PHP", "/D _USRDLL /D PHP7DLLTS_EXPORTS /D PHP_EXPORTS \
|
||||||
/D LIBZEND_EXPORTS /D TSRM_EXPORTS /D SAPI_EXPORTS /D WINVER=" + WINVER
|
/D LIBZEND_EXPORTS /D TSRM_EXPORTS /D SAPI_EXPORTS /D WINVER=" + WINVER);
|
||||||
+ " /D FCGI_EXPORTS");
|
|
||||||
|
|
||||||
DEFINE('CFLAGS_PHP_OBJ', '$(CFLAGS_PHP) $(STATIC_EXT_CFLAGS)');
|
DEFINE('CFLAGS_PHP_OBJ', '$(CFLAGS_PHP) $(STATIC_EXT_CFLAGS)');
|
||||||
1
|
1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue