mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2025-03-09 00:17:31 +00:00
community/uwsgi to 2.0.21-3
This commit is contained in:
parent
ee31c28dfd
commit
9c0db18645
3 changed files with 34 additions and 645 deletions
|
@ -19,14 +19,14 @@ pkgname=(
|
|||
uwsgi-plugin-cgi
|
||||
uwsgi-plugin-python
|
||||
uwsgi-plugin-php
|
||||
uwsgi-plugin-php7
|
||||
uwsgi-plugin-php-legacy
|
||||
uwsgi-plugin-lua51
|
||||
uwsgi-plugin-webdav
|
||||
uwsgi-plugin-zabbix
|
||||
uwsgi-plugin-notfound
|
||||
)
|
||||
pkgver=2.0.21
|
||||
pkgrel=2
|
||||
pkgrel=3
|
||||
pkgdesc="A full stack for building hosting services"
|
||||
arch=(x86_64)
|
||||
url="https://uwsgi-docs.readthedocs.io/en/latest/"
|
||||
|
@ -41,7 +41,7 @@ makedepends=(
|
|||
pcre
|
||||
perl
|
||||
php-embed
|
||||
php7-embed
|
||||
php-legacy-embed
|
||||
python
|
||||
python-gevent
|
||||
python-greenlet
|
||||
|
@ -63,6 +63,7 @@ source=(
|
|||
uwsgi.sysusers
|
||||
uwsgi.tmpfiles
|
||||
$pkgbase-1.9.13-ruby2.0.patch
|
||||
$pkgbase-2.0.22-php8.2.patch
|
||||
)
|
||||
sha512sums=('36a9c1b87a4c3d08482b9045d2227f56b006acb53f38ddf1b510880ae5fc24c0177a077338ec8af3ef0b8f8e220bc4fc7f8311dab8066e13cbcbb616f736c795'
|
||||
'51c474a5ae025c0fae17dec309bea29550a8ca39815b7495189394ae5ce30eb264f77a45f48f9f7529c59d907baf139cdf7c488d1b13fcb862cc7b9bdc268804'
|
||||
|
@ -74,7 +75,8 @@ sha512sums=('36a9c1b87a4c3d08482b9045d2227f56b006acb53f38ddf1b510880ae5fc24c0177
|
|||
'937878372aa1556f6ba62ad7148d1681288c94d6cff609368a9e861dd4d4524330006a08ae5993441f7d3101170e3a0a681a4c8b3c2c13b364b8b1f81cf25117'
|
||||
'9e9eab08199cf08810ec95b0697cd8817226986d1e3aeb54845c0140ea5887360580348f295060c0558fb2d6aaed26fec929ea36b28cfeaf2b3588ce40fec3df'
|
||||
'4def9dcd06cfc2c6ce554add9d9545a01f3bb2681f0a2a6fc4ba68f91011111803a955cc41b5e70832ca448b196109368fdf874e81b7ec0edee4b51f864e16f7'
|
||||
'162ca1be96282b32e8e6be919b6315bfd08954c491056958985bf99e7f5bdad3511665f059329d6cb6ef5d222f9aa11d4dc43c72e6a963ab941ada959fe8d964')
|
||||
'162ca1be96282b32e8e6be919b6315bfd08954c491056958985bf99e7f5bdad3511665f059329d6cb6ef5d222f9aa11d4dc43c72e6a963ab941ada959fe8d964'
|
||||
'd62db75b0e27bbc014ec5e69c360de79f523f33bc1ab15fe7957bf8531635be1bb77200d1ad6d50184eba18c6d56bcdd284082c042792ef7822233128bc22fbc')
|
||||
b2sums=('3c5fc3ce3a6a7f8f915bb302c0b775a75227f859dd2b141034e8b1aa5cb867b447ed532b3e8b537db80acc908fc26121b752e35ebc0bf9a542678843fd02ff54'
|
||||
'46f833e5d179d950bcbab51b539e6431959c9e3618c0d66b791a4b4d866b6195707704b394224b4fea97e1f65188b8b474499d70e5c2bb44da32c60447b80806'
|
||||
'835a1036422e9821cd52ffdf5a6053bdd59fc700d473600bda60b6730746f6c0750c30c85f4139d3ea81c6b6dd10d6849f9406decee3179861c51aca90da6161'
|
||||
|
@ -85,7 +87,8 @@ b2sums=('3c5fc3ce3a6a7f8f915bb302c0b775a75227f859dd2b141034e8b1aa5cb867b447ed532
|
|||
'a8b7d003f66ed5c5b1b60d57c05339af3dcdcf346eab52760810086e17f6936dd29ed7fd26281657bc86ac6721c989cbfbaa8e81f97111c807bcd06baece3bf2'
|
||||
'82e03ea95995cfa78abc4d930bd0c250f22788d9ca4dc0921cfbb44a965c0f851cbcc7a855e36ec6e6aa5bf33fbd313b4fe68a2f1c4b7935c2b297be25895324'
|
||||
'9759827f7619358383bf0e68c955522c0054620f742f5122a59888fadfc0bc20bd587eab7a77bc73e8ee4d20cf8f02625c07f241462e8ab9c08f5af509daaef3'
|
||||
'0068763ca5a2f1b60782f53070cbff8cf930e1463d9199b156b02413026bcdb3d923bffcbba063a26d620b8e734bdbd26a4c22776532546ad8c8e5c0c73bd7d6')
|
||||
'0068763ca5a2f1b60782f53070cbff8cf930e1463d9199b156b02413026bcdb3d923bffcbba063a26d620b8e734bdbd26a4c22776532546ad8c8e5c0c73bd7d6'
|
||||
'99ddfb9918395d9d04284c6ab5160986d1aa7cdb175237ff5d2af8438a7a78b535836dee3c16dd0b8c917a00fdc9e64880756595b3070b941c406d99580c102c')
|
||||
|
||||
prepare() {
|
||||
cd $pkgbase-$pkgver
|
||||
|
@ -98,12 +101,13 @@ prepare() {
|
|||
# move ruby plugin to new location and fix its name
|
||||
mv plugins/ruby{19,}
|
||||
sed -e 's/ruby19/ruby/' -i plugins/ruby/uwsgiplugin.py
|
||||
# duplicate the php plugin, so that we can modify it (and leave the php7
|
||||
# version unmodified)
|
||||
cp -av plugins/php{,7}
|
||||
# remove the explicit lib version from the linking stage of the PHP plugin as
|
||||
# we do not provide /usr/lib/libphp8.so
|
||||
sed -e "s/ + php_version//" -i plugins/php/uwsgiplugin.py
|
||||
# Compatibility with PHP 8.2
|
||||
patch -p1 -i "$srcdir/$pkgbase-2.0.22-php8.2.patch"
|
||||
# duplicate the php plugin, so that we can modify it
|
||||
cp -av plugins/php{,_legacy}
|
||||
# copy our custom build profile into place
|
||||
cp -v ../archlinux.ini buildconf/
|
||||
}
|
||||
|
@ -111,9 +115,9 @@ prepare() {
|
|||
build() {
|
||||
cd $pkgbase-$pkgver
|
||||
python uwsgiconfig.py --verbose --build archlinux
|
||||
# build php7 plugin separately and override php-config in use
|
||||
UWSGICONFIG_PHPPATH='php-config7' \
|
||||
python uwsgiconfig.py --verbose --plugin plugins/php7 archlinux php7
|
||||
# build php-legacy plugin separately and override php-config in use
|
||||
UWSGICONFIG_PHPPATH='php-config-legacy' \
|
||||
python uwsgiconfig.py --verbose --plugin plugins/php_legacy archlinux php_legacy
|
||||
}
|
||||
|
||||
package_uwsgi() {
|
||||
|
@ -187,12 +191,12 @@ package_uwsgi-plugin-php() {
|
|||
install -vDm 755 php_plugin.so -t "$pkgdir"/usr/lib/uwsgi/
|
||||
}
|
||||
|
||||
package_uwsgi-plugin-php7() {
|
||||
pkgdesc+=" (PHP7 plugin)"
|
||||
depends=(glibc php7-embed uwsgi)
|
||||
package_uwsgi-plugin-php-legacy() {
|
||||
pkgdesc+=" (PHP Legacy plugin)"
|
||||
depends=(glibc php-legacy-embed uwsgi)
|
||||
|
||||
cd $pkgbase-$pkgver
|
||||
install -vDm 755 php7_plugin.so -t "$pkgdir"/usr/lib/uwsgi/
|
||||
install -vDm 755 php_legacy_plugin.so -t "$pkgdir"/usr/lib/uwsgi/
|
||||
}
|
||||
|
||||
package_uwsgi-plugin-webdav() {
|
||||
|
|
|
@ -1,630 +0,0 @@
|
|||
diff --git c/plugins/php/common.h w/plugins/php/common.h
|
||||
index 9bf1c069..061b0b59 100644
|
||||
--- c/plugins/php/common.h
|
||||
+++ w/plugins/php/common.h
|
||||
@@ -3,11 +3,6 @@
|
||||
#include "php_main.h"
|
||||
#include "php_variables.h"
|
||||
|
||||
-#if (PHP_MAJOR_VERSION < 7)
|
||||
-#include "ext/standard/php_smart_str.h"
|
||||
-#else
|
||||
-#define UWSGI_PHP7
|
||||
-#endif
|
||||
#include "ext/standard/info.h"
|
||||
|
||||
#include "ext/session/php_session.h"
|
||||
diff --git c/plugins/php/php_plugin.c w/plugins/php/php_plugin.c
|
||||
index 5cec7805..717d6317 100644
|
||||
--- c/plugins/php/php_plugin.c
|
||||
+++ w/plugins/php/php_plugin.c
|
||||
@@ -4,6 +4,11 @@ extern struct uwsgi_server uwsgi;
|
||||
|
||||
static sapi_module_struct uwsgi_sapi_module;
|
||||
|
||||
+static int uwsgi_php_init(void);
|
||||
+
|
||||
+typedef size_t php_strlen_size;
|
||||
+typedef zend_long php_long_size;
|
||||
+
|
||||
struct uwsgi_php {
|
||||
struct uwsgi_string_list *allowed_docroot;
|
||||
struct uwsgi_string_list *allowed_ext;
|
||||
@@ -17,7 +22,6 @@ struct uwsgi_php {
|
||||
struct uwsgi_string_list *vars;
|
||||
struct uwsgi_string_list *constants;
|
||||
char *docroot;
|
||||
- size_t docroot_len;
|
||||
char *app;
|
||||
char *app_qs;
|
||||
char *fallback;
|
||||
@@ -32,7 +36,10 @@ struct uwsgi_php {
|
||||
struct uwsgi_string_list *exec_after;
|
||||
|
||||
char *sapi_name;
|
||||
+
|
||||
+ int sapi_initialized;
|
||||
HashTable user_config_cache;
|
||||
+ struct uwsgi_dyn_dict *mountpoint;
|
||||
} uphp;
|
||||
|
||||
void uwsgi_opt_php_ini(char *opt, char *value, void *foobar) {
|
||||
@@ -40,6 +47,10 @@ void uwsgi_opt_php_ini(char *opt, char *value, void *foobar) {
|
||||
uwsgi_sapi_module.php_ini_ignore = 1;
|
||||
}
|
||||
|
||||
+void uwsgi_opt_early_php(char *opt, char *value, void *foobar) {
|
||||
+ uwsgi_php_init();
|
||||
+}
|
||||
+
|
||||
struct uwsgi_option uwsgi_php_options[] = {
|
||||
|
||||
{"php-ini", required_argument, 0, "set php.ini path", uwsgi_opt_php_ini, NULL, 0},
|
||||
@@ -69,15 +80,15 @@ struct uwsgi_option uwsgi_php_options[] = {
|
||||
{"php-exec-after", required_argument, 0, "run specified php code after the requested script", uwsgi_opt_add_string_list, &uphp.exec_after, 0},
|
||||
{"php-exec-end", required_argument, 0, "run specified php code after the requested script", uwsgi_opt_add_string_list, &uphp.exec_after, 0},
|
||||
{"php-sapi-name", required_argument, 0, "hack the sapi name (required for enabling zend opcode cache)", uwsgi_opt_set_str, &uphp.sapi_name, 0},
|
||||
+
|
||||
+ {"early-php", no_argument, 0, "initialize an early perl interpreter shared by all loaders", uwsgi_opt_early_php, NULL, UWSGI_OPT_IMMEDIATE},
|
||||
+ {"early-php-sapi-name", required_argument, 0, "hack the sapi name (required for enabling zend opcode cache)", uwsgi_opt_set_str, &uphp.sapi_name, UWSGI_OPT_IMMEDIATE},
|
||||
+ {"php-mount", required_argument, 0, "add a php mountpoint", uwsgi_opt_add_dyn_dict, &uphp.mountpoint, 0},
|
||||
UWSGI_END_OF_OPTIONS
|
||||
};
|
||||
|
||||
|
||||
-#ifdef UWSGI_PHP7
|
||||
-static size_t sapi_uwsgi_ub_write(const char *str, size_t str_length TSRMLS_DC)
|
||||
-#else
|
||||
-static int sapi_uwsgi_ub_write(const char *str, uint str_length TSRMLS_DC)
|
||||
-#endif
|
||||
+static size_t sapi_uwsgi_ub_write(const char *str, size_t str_length)
|
||||
{
|
||||
struct wsgi_request *wsgi_req = (struct wsgi_request *) SG(server_context);
|
||||
|
||||
@@ -89,7 +100,7 @@ static int sapi_uwsgi_ub_write(const char *str, uint str_length TSRMLS_DC)
|
||||
return str_length;
|
||||
}
|
||||
|
||||
-static int sapi_uwsgi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
|
||||
+static int sapi_uwsgi_send_headers(sapi_headers_struct *sapi_headers)
|
||||
{
|
||||
sapi_header_struct *h;
|
||||
zend_llist_position pos;
|
||||
@@ -123,11 +134,7 @@ static int sapi_uwsgi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
|
||||
return SAPI_HEADER_SENT_SUCCESSFULLY;
|
||||
}
|
||||
|
||||
-#ifdef UWSGI_PHP7
|
||||
-static size_t sapi_uwsgi_read_post(char *buffer, size_t count_bytes TSRMLS_DC)
|
||||
-#else
|
||||
-static int sapi_uwsgi_read_post(char *buffer, uint count_bytes TSRMLS_DC)
|
||||
-#endif
|
||||
+static size_t sapi_uwsgi_read_post(char *buffer, size_t count_bytes)
|
||||
{
|
||||
uint read_bytes = 0;
|
||||
|
||||
@@ -151,7 +158,7 @@ static int sapi_uwsgi_read_post(char *buffer, uint count_bytes TSRMLS_DC)
|
||||
}
|
||||
|
||||
|
||||
-static char *sapi_uwsgi_read_cookies(TSRMLS_D)
|
||||
+static char *sapi_uwsgi_read_cookies()
|
||||
{
|
||||
uint16_t len = 0;
|
||||
struct wsgi_request *wsgi_req = (struct wsgi_request *) SG(server_context);
|
||||
@@ -164,55 +171,55 @@ static char *sapi_uwsgi_read_cookies(TSRMLS_D)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-static void sapi_uwsgi_register_variables(zval *track_vars_array TSRMLS_DC)
|
||||
+static void sapi_uwsgi_register_variables(zval *track_vars_array)
|
||||
{
|
||||
int i;
|
||||
struct wsgi_request *wsgi_req = (struct wsgi_request *) SG(server_context);
|
||||
- php_import_environment_variables(track_vars_array TSRMLS_CC);
|
||||
+ php_import_environment_variables(track_vars_array);
|
||||
|
||||
if (uphp.server_software) {
|
||||
if (!uphp.server_software_len) uphp.server_software_len = strlen(uphp.server_software);
|
||||
- php_register_variable_safe("SERVER_SOFTWARE", uphp.server_software, uphp.server_software_len, track_vars_array TSRMLS_CC);
|
||||
+ php_register_variable_safe("SERVER_SOFTWARE", uphp.server_software, uphp.server_software_len, track_vars_array);
|
||||
}
|
||||
else {
|
||||
- php_register_variable_safe("SERVER_SOFTWARE", "uWSGI", 5, track_vars_array TSRMLS_CC);
|
||||
+ php_register_variable_safe("SERVER_SOFTWARE", "uWSGI", 5, track_vars_array);
|
||||
}
|
||||
|
||||
for (i = 0; i < wsgi_req->var_cnt; i += 2) {
|
||||
php_register_variable_safe( estrndup(wsgi_req->hvec[i].iov_base, wsgi_req->hvec[i].iov_len),
|
||||
wsgi_req->hvec[i + 1].iov_base, wsgi_req->hvec[i + 1].iov_len,
|
||||
- track_vars_array TSRMLS_CC);
|
||||
+ track_vars_array);
|
||||
}
|
||||
|
||||
- php_register_variable_safe("PATH_INFO", wsgi_req->path_info, wsgi_req->path_info_len, track_vars_array TSRMLS_CC);
|
||||
+ php_register_variable_safe("PATH_INFO", wsgi_req->path_info, wsgi_req->path_info_len, track_vars_array);
|
||||
if (wsgi_req->query_string_len > 0) {
|
||||
- php_register_variable_safe("QUERY_STRING", wsgi_req->query_string, wsgi_req->query_string_len, track_vars_array TSRMLS_CC);
|
||||
+ php_register_variable_safe("QUERY_STRING", wsgi_req->query_string, wsgi_req->query_string_len, track_vars_array);
|
||||
}
|
||||
|
||||
- php_register_variable_safe("SCRIPT_NAME", wsgi_req->script_name, wsgi_req->script_name_len, track_vars_array TSRMLS_CC);
|
||||
- php_register_variable_safe("SCRIPT_FILENAME", wsgi_req->file, wsgi_req->file_len, track_vars_array TSRMLS_CC);
|
||||
+ php_register_variable_safe("SCRIPT_NAME", wsgi_req->script_name, wsgi_req->script_name_len, track_vars_array);
|
||||
+ php_register_variable_safe("SCRIPT_FILENAME", wsgi_req->file, wsgi_req->file_len, track_vars_array);
|
||||
|
||||
- php_register_variable_safe("DOCUMENT_ROOT", wsgi_req->document_root, wsgi_req->document_root_len, track_vars_array TSRMLS_CC);
|
||||
+ php_register_variable_safe("DOCUMENT_ROOT", wsgi_req->document_root, wsgi_req->document_root_len, track_vars_array);
|
||||
|
||||
if (wsgi_req->path_info_len) {
|
||||
char *path_translated = ecalloc(1, wsgi_req->file_len + wsgi_req->path_info_len + 1);
|
||||
|
||||
memcpy(path_translated, wsgi_req->file, wsgi_req->file_len);
|
||||
memcpy(path_translated + wsgi_req->file_len, wsgi_req->path_info, wsgi_req->path_info_len);
|
||||
- php_register_variable_safe("PATH_TRANSLATED", path_translated, wsgi_req->file_len + wsgi_req->path_info_len , track_vars_array TSRMLS_CC);
|
||||
+ php_register_variable_safe("PATH_TRANSLATED", path_translated, wsgi_req->file_len + wsgi_req->path_info_len , track_vars_array);
|
||||
}
|
||||
else {
|
||||
- php_register_variable_safe("PATH_TRANSLATED", "", 0, track_vars_array TSRMLS_CC);
|
||||
+ php_register_variable_safe("PATH_TRANSLATED", "", 0, track_vars_array);
|
||||
}
|
||||
|
||||
- php_register_variable_safe("PHP_SELF", wsgi_req->script_name, wsgi_req->script_name_len, track_vars_array TSRMLS_CC);
|
||||
+ php_register_variable_safe("PHP_SELF", wsgi_req->script_name, wsgi_req->script_name_len, track_vars_array);
|
||||
|
||||
struct uwsgi_string_list *usl = uphp.vars;
|
||||
while(usl) {
|
||||
char *equal = strchr(usl->value, '=');
|
||||
if (equal) {
|
||||
php_register_variable_safe( estrndup(usl->value, equal-usl->value),
|
||||
- equal+1, strlen(equal+1), track_vars_array TSRMLS_CC);
|
||||
+ equal+1, strlen(equal+1), track_vars_array);
|
||||
}
|
||||
usl = usl->next;
|
||||
}
|
||||
@@ -253,10 +260,7 @@ PHP_MINIT_FUNCTION(uwsgi_php_minit) {
|
||||
char *name = usl->value;
|
||||
char *strval = equal + 1;
|
||||
equal = NULL;
|
||||
-#ifndef UWSGI_PHP7
|
||||
- name_len = name_len + 1;
|
||||
-#endif
|
||||
- zend_register_string_constant(name, name_len, strval, CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC);
|
||||
+ zend_register_string_constant(name, name_len, strval, CONST_CS | CONST_PERSISTENT, module_number);
|
||||
}
|
||||
usl = usl->next;
|
||||
}
|
||||
@@ -264,11 +268,7 @@ PHP_MINIT_FUNCTION(uwsgi_php_minit) {
|
||||
}
|
||||
|
||||
PHP_FUNCTION(uwsgi_version) {
|
||||
-#ifdef UWSGI_PHP7
|
||||
RETURN_STRING(UWSGI_VERSION);
|
||||
-#else
|
||||
- RETURN_STRING(UWSGI_VERSION, 1);
|
||||
-#endif
|
||||
}
|
||||
|
||||
PHP_FUNCTION(uwsgi_worker_id) {
|
||||
@@ -285,11 +285,11 @@ PHP_FUNCTION(uwsgi_masterpid) {
|
||||
PHP_FUNCTION(uwsgi_cache_exists) {
|
||||
|
||||
char *key = NULL;
|
||||
- int keylen = 0;
|
||||
+ php_strlen_size keylen = 0;
|
||||
char *cache = NULL;
|
||||
- int cachelen = 0;
|
||||
+ php_strlen_size cachelen = 0;
|
||||
|
||||
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &key, &keylen, &cache, &cachelen) == FAILURE) {
|
||||
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", &key, &keylen, &cache, &cachelen) == FAILURE) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
@@ -303,9 +303,9 @@ PHP_FUNCTION(uwsgi_cache_exists) {
|
||||
PHP_FUNCTION(uwsgi_cache_clear) {
|
||||
|
||||
char *cache = NULL;
|
||||
- int cachelen = 0;
|
||||
+ php_strlen_size cachelen = 0;
|
||||
|
||||
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &cache, &cachelen) == FAILURE) {
|
||||
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &cache, &cachelen) == FAILURE) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
@@ -318,13 +318,13 @@ PHP_FUNCTION(uwsgi_cache_clear) {
|
||||
|
||||
|
||||
PHP_FUNCTION(uwsgi_cache_del) {
|
||||
-
|
||||
+
|
||||
char *key = NULL;
|
||||
- int keylen = 0;
|
||||
+ php_strlen_size keylen = 0;
|
||||
char *cache = NULL;
|
||||
- int cachelen = 0;
|
||||
+ php_strlen_size cachelen = 0;
|
||||
|
||||
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &key, &keylen, &cache, &cachelen) == FAILURE) {
|
||||
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", &key, &keylen, &cache, &cachelen) == FAILURE) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
@@ -338,15 +338,15 @@ PHP_FUNCTION(uwsgi_cache_del) {
|
||||
PHP_FUNCTION(uwsgi_cache_get) {
|
||||
|
||||
char *key = NULL;
|
||||
- int keylen = 0;
|
||||
+ php_strlen_size keylen = 0;
|
||||
char *cache = NULL;
|
||||
- int cachelen = 0;
|
||||
+ php_strlen_size cachelen = 0;
|
||||
uint64_t valsize;
|
||||
|
||||
if (!uwsgi.caches)
|
||||
RETURN_NULL();
|
||||
|
||||
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &key, &keylen, &cache, &cachelen) == FAILURE) {
|
||||
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", &key, &keylen, &cache, &cachelen) == FAILURE) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
@@ -354,28 +354,24 @@ PHP_FUNCTION(uwsgi_cache_get) {
|
||||
if (value) {
|
||||
char *ret = estrndup(value, valsize);
|
||||
free(value);
|
||||
-#ifdef UWSGI_PHP7
|
||||
RETURN_STRING(ret);
|
||||
-#else
|
||||
- RETURN_STRING(ret, 0);
|
||||
-#endif
|
||||
}
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
PHP_FUNCTION(uwsgi_cache_set) {
|
||||
char *key = NULL;
|
||||
- int keylen;
|
||||
+ php_strlen_size keylen = 0;
|
||||
char *value = NULL;
|
||||
- int vallen;
|
||||
- uint64_t expires = 0;
|
||||
+ php_strlen_size vallen = 0;
|
||||
+ php_long_size expires = 0;
|
||||
char *cache = NULL;
|
||||
- int cachelen = 0;
|
||||
+ php_strlen_size cachelen = 0;
|
||||
|
||||
if (!uwsgi.caches)
|
||||
RETURN_NULL();
|
||||
|
||||
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ls", &key, &keylen, &value, &vallen, &expires, &cache, &cachelen) == FAILURE) {
|
||||
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|ls", &key, &keylen, &value, &vallen, &expires, &cache, &cachelen) == FAILURE) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
@@ -388,17 +384,17 @@ PHP_FUNCTION(uwsgi_cache_set) {
|
||||
|
||||
PHP_FUNCTION(uwsgi_cache_update) {
|
||||
char *key = NULL;
|
||||
- int keylen;
|
||||
+ php_strlen_size keylen = 0;
|
||||
char *value = NULL;
|
||||
- int vallen;
|
||||
- uint64_t expires = 0;
|
||||
+ php_strlen_size vallen = 0;
|
||||
+ php_long_size expires = 0;
|
||||
char *cache = NULL;
|
||||
- int cachelen = 0;
|
||||
+ php_strlen_size cachelen = 0;
|
||||
|
||||
if (!uwsgi.caches)
|
||||
RETURN_NULL();
|
||||
|
||||
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ls", &key, &keylen, &value, &vallen, &expires, &cache, &cachelen) == FAILURE) {
|
||||
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|ls", &key, &keylen, &value, &vallen, &expires, &cache, &cachelen) == FAILURE) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
@@ -423,7 +419,7 @@ PHP_FUNCTION(uwsgi_rpc) {
|
||||
uint16_t argvs[256];
|
||||
uint64_t size = 0;
|
||||
|
||||
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", &varargs, &num_args) == FAILURE) {
|
||||
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "+", &varargs, &num_args) == FAILURE) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
@@ -462,11 +458,7 @@ PHP_FUNCTION(uwsgi_rpc) {
|
||||
// here we do not free varargs for performance reasons
|
||||
char *ret = estrndup(response, size);
|
||||
free(response);
|
||||
-#ifdef UWSGI_PHP7
|
||||
RETURN_STRING(ret);
|
||||
-#else
|
||||
- RETURN_STRING(ret, 0);
|
||||
-#endif
|
||||
}
|
||||
|
||||
clear:
|
||||
@@ -481,7 +473,7 @@ PHP_FUNCTION(uwsgi_setprocname) {
|
||||
char *name;
|
||||
int name_len;
|
||||
|
||||
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
|
||||
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
@@ -495,7 +487,7 @@ PHP_FUNCTION(uwsgi_signal) {
|
||||
long long_signum;
|
||||
uint8_t signum = 0;
|
||||
|
||||
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &long_signum) == FAILURE) {
|
||||
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &long_signum) == FAILURE) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
@@ -629,10 +621,12 @@ static int php_uwsgi_startup(sapi_module_struct *sapi_module)
|
||||
}
|
||||
}
|
||||
|
||||
-#if ((PHP_MAJOR_VERSION >= 7) && (PHP_MINOR_VERSION >= 1))
|
||||
+#if (PHP_MAJOR_VERSION >= 8)
|
||||
+static void sapi_uwsgi_log_message(const char *message, int syslog_type_int) {
|
||||
+#elif ((PHP_MAJOR_VERSION == 7) && (PHP_MINOR_VERSION >= 1))
|
||||
static void sapi_uwsgi_log_message(char *message, int syslog_type_int) {
|
||||
#else
|
||||
-static void sapi_uwsgi_log_message(char *message TSRMLS_DC) {
|
||||
+static void sapi_uwsgi_log_message(char *message) {
|
||||
#endif
|
||||
uwsgi_log("%s\n", message);
|
||||
}
|
||||
@@ -668,16 +662,32 @@ static sapi_module_struct uwsgi_sapi_module = {
|
||||
STANDARD_SAPI_MODULE_PROPERTIES
|
||||
};
|
||||
|
||||
-int uwsgi_php_init(void) {
|
||||
+static void uwsgi_php_init_mount(struct uwsgi_dyn_dict *mount_dict) {
|
||||
+ struct uwsgi_dyn_dict *udd = mount_dict;
|
||||
+ while (udd) {
|
||||
+ char *orig_dest = udd->value;
|
||||
+ udd->value = uwsgi_expand_path(udd->value, udd->vallen, NULL);
|
||||
+ udd->vallen = strlen(udd->value);
|
||||
+ if (!udd->value) {
|
||||
+ uwsgi_log("Unable to expand php mountpoint to %s\n", orig_dest);
|
||||
+ exit(1);
|
||||
+ }
|
||||
+ udd = udd->next;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static int uwsgi_php_init(void) {
|
||||
|
||||
struct uwsgi_string_list *pset = uphp.set;
|
||||
struct uwsgi_string_list *append_config = uphp.append_config;
|
||||
|
||||
+ if (!uphp.sapi_initialized) {
|
||||
#ifdef ZTS
|
||||
- tsrm_startup(1, 1, 0, NULL);
|
||||
+ tsrm_startup(1, 1, 0, NULL);
|
||||
#endif
|
||||
-
|
||||
- sapi_startup(&uwsgi_sapi_module);
|
||||
+ sapi_startup(&uwsgi_sapi_module);
|
||||
+ uphp.sapi_initialized = 1;
|
||||
+ }
|
||||
|
||||
// applying custom options
|
||||
while(append_config) {
|
||||
@@ -705,13 +715,14 @@ int uwsgi_php_init(void) {
|
||||
uwsgi_log("unable to set php docroot to %s\n", orig_docroot);
|
||||
exit(1);
|
||||
}
|
||||
- uwsgi_log("PHP document root set to %s\n", uphp.docroot);
|
||||
- uphp.docroot_len = strlen(uphp.docroot);
|
||||
}
|
||||
|
||||
+ uwsgi_php_init_mount(uphp.mountpoint);
|
||||
+
|
||||
if (uphp.sapi_name) {
|
||||
uwsgi_sapi_module.name = uphp.sapi_name;
|
||||
}
|
||||
+
|
||||
uwsgi_sapi_module.startup(&uwsgi_sapi_module);
|
||||
uwsgi_log("PHP %s initialized\n", PHP_VERSION);
|
||||
|
||||
@@ -776,6 +787,33 @@ int uwsgi_php_walk(struct wsgi_request *wsgi_req, char *full_path, char *docroot
|
||||
|
||||
}
|
||||
|
||||
+static char *uwsgi_php_get_mount(char *path_info, uint16_t path_info_len, struct uwsgi_dyn_dict *mount_dict, int *discard_base) {
|
||||
+ int best_found = 0;
|
||||
+ struct uwsgi_dyn_dict *udd = mount_dict, *chosen = NULL;
|
||||
+
|
||||
+ while (udd) {
|
||||
+ if (mount_dict->vallen) {
|
||||
+ if (!uwsgi_starts_with(path_info, path_info_len, udd->key, udd->keylen)) {
|
||||
+ if (udd->keylen > best_found) {
|
||||
+ best_found = udd->keylen;
|
||||
+ chosen = udd;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ udd = udd->next;
|
||||
+ }
|
||||
+
|
||||
+ if (chosen) {
|
||||
+ *discard_base = chosen->keylen;
|
||||
+ if (chosen->key[chosen->keylen-1] == '/') {
|
||||
+ *discard_base = *discard_base - 1;
|
||||
+ }
|
||||
+ return chosen->value;
|
||||
+ } else {
|
||||
+ return NULL;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
|
||||
int uwsgi_php_request(struct wsgi_request *wsgi_req) {
|
||||
|
||||
@@ -788,10 +826,6 @@ int uwsgi_php_request(struct wsgi_request *wsgi_req) {
|
||||
|
||||
zend_file_handle file_handle;
|
||||
|
||||
-#ifdef ZTS
|
||||
- TSRMLS_FETCH();
|
||||
-#endif
|
||||
-
|
||||
SG(server_context) = (void *) wsgi_req;
|
||||
|
||||
if (uwsgi_parse_vars(wsgi_req)) {
|
||||
@@ -801,7 +835,15 @@ int uwsgi_php_request(struct wsgi_request *wsgi_req) {
|
||||
char *orig_path_info = wsgi_req->path_info;
|
||||
uint16_t orig_path_info_len = wsgi_req->path_info_len;
|
||||
|
||||
- if (uphp.docroot) {
|
||||
+ int discard_base = 0;
|
||||
+
|
||||
+ char *mount_docroot = uwsgi_php_get_mount(wsgi_req->path_info, wsgi_req->path_info_len, uphp.mountpoint, &discard_base);
|
||||
+
|
||||
+ if (mount_docroot) {
|
||||
+ wsgi_req->document_root = mount_docroot;
|
||||
+ wsgi_req->path_info = wsgi_req->path_info+discard_base;
|
||||
+ wsgi_req->path_info_len = wsgi_req->path_info_len-discard_base;
|
||||
+ } else if (uphp.docroot) {
|
||||
wsgi_req->document_root = uphp.docroot;
|
||||
}
|
||||
// fallback to cwd
|
||||
@@ -833,7 +875,8 @@ int uwsgi_php_request(struct wsgi_request *wsgi_req) {
|
||||
}
|
||||
#endif
|
||||
|
||||
- strcpy(real_filename, uphp.app);
|
||||
+ strncpy(real_filename, uphp.app, PATH_MAX);
|
||||
+ real_filename[PATH_MAX-1] = '\0';
|
||||
if (wsgi_req->path_info_len == 1 && wsgi_req->path_info[0] == '/') {
|
||||
goto appready;
|
||||
}
|
||||
@@ -926,7 +969,6 @@ oldstyle:
|
||||
free(filename);
|
||||
real_filename_len = strlen(real_filename);
|
||||
|
||||
- // first check for valid doc roots
|
||||
if (uphp.allowed_docroot) {
|
||||
struct uwsgi_string_list *usl = uphp.allowed_docroot;
|
||||
while(usl) {
|
||||
@@ -939,16 +981,6 @@ oldstyle:
|
||||
uwsgi_log("PHP security error: %s is not under an allowed docroot\n", real_filename);
|
||||
return -1;
|
||||
}
|
||||
- // then for default docroot (if any)
|
||||
- else if (uphp.docroot)
|
||||
- {
|
||||
- if (!uwsgi_starts_with(real_filename, real_filename_len, uphp.docroot, uphp.docroot_len)) {
|
||||
- goto secure;
|
||||
- }
|
||||
- uwsgi_403(wsgi_req);
|
||||
- uwsgi_log("PHP security error: %s is not under the default docroot\n", real_filename);
|
||||
- return -1;
|
||||
- }
|
||||
|
||||
secure:
|
||||
|
||||
@@ -1065,7 +1097,7 @@ secure3:
|
||||
file_handle.type = ZEND_HANDLE_FILENAME;
|
||||
file_handle.filename = real_filename;
|
||||
|
||||
- if (php_request_startup(TSRMLS_C) == FAILURE) {
|
||||
+ if (php_request_startup() == FAILURE) {
|
||||
uwsgi_500(wsgi_req);
|
||||
return -1;
|
||||
}
|
||||
@@ -1073,13 +1105,13 @@ secure3:
|
||||
struct uwsgi_string_list *usl=NULL;
|
||||
|
||||
uwsgi_foreach(usl, uphp.exec_before) {
|
||||
- if (zend_eval_string_ex(usl->value, NULL, "uWSGI php exec before", 1 TSRMLS_CC) == FAILURE) goto end;
|
||||
+ if (zend_eval_string_ex(usl->value, NULL, "uWSGI php exec before", 1) == FAILURE) goto end;
|
||||
}
|
||||
|
||||
- php_execute_script(&file_handle TSRMLS_CC);
|
||||
+ php_execute_script(&file_handle);
|
||||
|
||||
uwsgi_foreach(usl, uphp.exec_after) {
|
||||
- if (zend_eval_string_ex(usl->value, NULL, "uWSGI php exec after", 1 TSRMLS_CC) == FAILURE) goto end;
|
||||
+ if (zend_eval_string_ex(usl->value, NULL, "uWSGI php exec after", 1) == FAILURE) goto end;
|
||||
}
|
||||
|
||||
end:
|
||||
diff --git c/plugins/php/session.c w/plugins/php/session.c
|
||||
index 2312b6b9..cce06985 100644
|
||||
--- c/plugins/php/session.c
|
||||
+++ w/plugins/php/session.c
|
||||
@@ -12,34 +12,20 @@ PS_CLOSE_FUNC(uwsgi) {
|
||||
PS_READ_FUNC(uwsgi) {
|
||||
char *cache = PS_GET_MOD_DATA();
|
||||
uint64_t valsize = 0;
|
||||
-#ifdef UWSGI_PHP7
|
||||
char *value = uwsgi_cache_magic_get(key->val, key->len , &valsize, NULL, cache);
|
||||
-#else
|
||||
- char *value = uwsgi_cache_magic_get((char *)key, strlen((char *)key), &valsize, NULL, cache);
|
||||
-#endif
|
||||
- if (!value) return FAILURE;
|
||||
-#ifdef UWSGI_PHP7
|
||||
+ if (!value) {
|
||||
+ *val = STR_EMPTY_ALLOC();
|
||||
+ return SUCCESS;
|
||||
+ }
|
||||
*val = zend_string_init(value, valsize, 0);
|
||||
-#else
|
||||
- char *new_val = emalloc(valsize);
|
||||
- memcpy(new_val, value, valsize);
|
||||
- free(value);
|
||||
- *val = new_val;
|
||||
- *vallen = valsize;
|
||||
-#endif
|
||||
return SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
PS_WRITE_FUNC(uwsgi) {
|
||||
char *cache = PS_GET_MOD_DATA();
|
||||
-#ifdef UWSGI_PHP7
|
||||
if (val->len == 0) return SUCCESS;
|
||||
if (!uwsgi_cache_magic_set(key->val, key->len, val->val, val->len, 0, UWSGI_CACHE_FLAG_UPDATE, cache)) {
|
||||
-#else
|
||||
- if (vallen == 0) return SUCCESS;
|
||||
- if (!uwsgi_cache_magic_set((char *)key, strlen(key), (char *)val, vallen, 0, UWSGI_CACHE_FLAG_UPDATE, cache)) {
|
||||
-#endif
|
||||
return SUCCESS;
|
||||
}
|
||||
return FAILURE;
|
||||
@@ -47,11 +33,10 @@ PS_WRITE_FUNC(uwsgi) {
|
||||
|
||||
PS_DESTROY_FUNC(uwsgi) {
|
||||
char *cache = PS_GET_MOD_DATA();
|
||||
-#ifdef UWSGI_PHP7
|
||||
+ if (!uwsgi_cache_magic_exists(key->val, key->len, cache))
|
||||
+ return SUCCESS;
|
||||
+
|
||||
if (!uwsgi_cache_magic_del(key->val, key->len, cache)) {
|
||||
-#else
|
||||
- if (!uwsgi_cache_magic_del((char *)key, strlen(key), cache)) {
|
||||
-#endif
|
||||
return SUCCESS;
|
||||
}
|
||||
return FAILURE;
|
||||
diff --git c/plugins/php/uwsgiplugin.py w/plugins/php/uwsgiplugin.py
|
||||
index d930c44e..8657eb70 100644
|
||||
--- c/plugins/php/uwsgiplugin.py
|
||||
+++ w/plugins/php/uwsgiplugin.py
|
||||
@@ -1,6 +1,6 @@
|
||||
import os
|
||||
|
||||
-NAME='php'
|
||||
+NAME = 'php'
|
||||
|
||||
ld_run_path = None
|
||||
PHPPATH = 'php-config'
|
15
community/uwsgi/uwsgi-2.0.22-php8.2.patch
Normal file
15
community/uwsgi/uwsgi-2.0.22-php8.2.patch
Normal file
|
@ -0,0 +1,15 @@
|
|||
diff -uNr a/plugins/php/php_plugin.c b/plugins/php/php_plugin.c
|
||||
--- a/plugins/php/php_plugin.c 2022-10-06 19:52:07.237882916 +0200
|
||||
+++ b/plugins/php/php_plugin.c 2022-10-06 19:56:29.232418542 +0200
|
||||
@@ -607,7 +607,11 @@
|
||||
static int php_uwsgi_startup(sapi_module_struct *sapi_module)
|
||||
{
|
||||
|
||||
+#if PHP_VERSION_ID >= 80200
|
||||
+ if (php_module_startup(&uwsgi_sapi_module, &uwsgi_module_entry)==FAILURE) {
|
||||
+#else
|
||||
if (php_module_startup(&uwsgi_sapi_module, &uwsgi_module_entry, 1)==FAILURE) {
|
||||
+#endif
|
||||
return FAILURE;
|
||||
} else {
|
||||
return SUCCESS;
|
Loading…
Reference in a new issue