summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2018-10-25 09:31:41 +0200
committerRemi Collet <remi@remirepo.net>2018-10-25 09:31:41 +0200
commit17e7969160e95bcf31c74bc0860f725083d8f683 (patch)
treec5f25d89ae4cc9f5f049c6722c6a74a21c6dfb53
parent0ccc0239b364376a73a4a0d24e7217f781835b2f (diff)
FPM: add getallheaders, backported from 7.3
-rw-r--r--failed.txt6
-rw-r--r--php-7.1.24-getallheaders.patch207
-rw-r--r--php.spec8
3 files changed, 217 insertions, 4 deletions
diff --git a/failed.txt b/failed.txt
index a53bcc2..bb57adb 100644
--- a/failed.txt
+++ b/failed.txt
@@ -4,13 +4,13 @@ $ grep -r 'Tests failed' /var/lib/mock/scl71*/build.log
/var/lib/mock/scl71el6x/build.log:Tests failed : 0
/var/lib/mock/scl71el7x/build.log:Tests failed : 0
-/var/lib/mock/scl71fc26x/build.log:Tests failed : 0
-/var/lib/mock/scl71fc27x/build.log:Tests failed : 1
+/var/lib/mock/scl71fc26x/build.log:Tests failed : 1
+/var/lib/mock/scl71fc27x/build.log:Tests failed : 0
/var/lib/mock/scl71fc28x/build.log:Tests failed : 0
/var/lib/mock/scl71fc29x/build.log:Tests failed : 0
-fc27x
+fc26x:
file upload greater than 2G [sapi/cli/tests/upload_2G.phpt]
diff --git a/php-7.1.24-getallheaders.patch b/php-7.1.24-getallheaders.patch
new file mode 100644
index 0000000..49b2f71
--- /dev/null
+++ b/php-7.1.24-getallheaders.patch
@@ -0,0 +1,207 @@
+Adapted for 7.1 from 7.3 by remi
+
+
+From 0ea4013f101d64fbeb9221260b36e98f10ed1ddd Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Wed, 4 Jul 2018 08:48:38 +0200
+Subject: [PATCH] Fixed bug #62596 add getallheaders (apache_request_headers)
+ missing function in FPM add sapi_add_request_header in public API (was
+ add_request_header) fix arginfo for fastcgi_finish_request fucntion
+
+---
+ main/SAPI.c | 50 +++++++++++++++++++++++++++++
+ main/SAPI.h | 1 +
+ sapi/cgi/cgi_main.c | 51 +----------------------------
+ sapi/fpm/fpm/fpm_main.c | 25 ++++++++++++++-
+ sapi/fpm/tests/getallheaders.phpt | 67 +++++++++++++++++++++++++++++++++++++++
+ 5 files changed, 143 insertions(+), 51 deletions(-)
+ create mode 100644 sapi/fpm/tests/getallheaders.phpt
+
+diff --git a/main/SAPI.c b/main/SAPI.c
+index b6c3329..7e0c7c8 100644
+--- a/main/SAPI.c
++++ b/main/SAPI.c
+@@ -1104,6 +1104,56 @@ SAPI_API void sapi_terminate_process(void) {
+ }
+ }
+
++SAPI_API void sapi_add_request_header(char *var, unsigned int var_len, char *val, unsigned int val_len, void *arg) /* {{{ */
++{
++ zval *return_value = (zval*)arg;
++ char *str = NULL;
++
++ ALLOCA_FLAG(use_heap)
++
++ if (var_len > 5 &&
++ var[0] == 'H' &&
++ var[1] == 'T' &&
++ var[2] == 'T' &&
++ var[3] == 'P' &&
++ var[4] == '_') {
++
++ char *p;
++
++ var_len -= 5;
++ p = var + 5;
++ var = str = do_alloca(var_len + 1, use_heap);
++ *str++ = *p++;
++ while (*p) {
++ if (*p == '_') {
++ *str++ = '-';
++ p++;
++ if (*p) {
++ *str++ = *p++;
++ }
++ } else if (*p >= 'A' && *p <= 'Z') {
++ *str++ = (*p++ - 'A' + 'a');
++ } else {
++ *str++ = *p++;
++ }
++ }
++ *str = 0;
++ } else if (var_len == sizeof("CONTENT_TYPE")-1 &&
++ memcmp(var, "CONTENT_TYPE", sizeof("CONTENT_TYPE")-1) == 0) {
++ var = "Content-Type";
++ } else if (var_len == sizeof("CONTENT_LENGTH")-1 &&
++ memcmp(var, "CONTENT_LENGTH", sizeof("CONTENT_LENGTH")-1) == 0) {
++ var = "Content-Length";
++ } else {
++ return;
++ }
++ add_assoc_stringl_ex(return_value, var, var_len, val, val_len);
++ if (str) {
++ free_alloca(var, use_heap);
++ }
++}
++/* }}} */
++
+ /*
+ * Local variables:
+ * tab-width: 4
+diff --git a/main/SAPI.h b/main/SAPI.h
+index f829fd7..4b8e223 100644
+--- a/main/SAPI.h
++++ b/main/SAPI.h
+@@ -152,6 +152,7 @@ SAPI_API void sapi_shutdown(void);
+ SAPI_API void sapi_activate(void);
+ SAPI_API void sapi_deactivate(void);
+ SAPI_API void sapi_initialize_empty_request(void);
++SAPI_API void sapi_add_request_header(char *var, unsigned int var_len, char *val, unsigned int val_len, void *arg);
+ END_EXTERN_C()
+
+ /*
+diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
+index 2e9cefe..350846d 100644
+--- a/sapi/cgi/cgi_main.c
++++ b/sapi/cgi/cgi_main.c
+@@ -1592,54 +1592,6 @@ PHP_FUNCTION(apache_child_terminate) /*
+ }
+ /* }}} */
+
+-static void add_request_header(char *var, unsigned int var_len, char *val, unsigned int val_len, void *arg) /* {{{ */
+-{
+- zval *return_value = (zval*)arg;
+- char *str = NULL;
+- char *p;
+- ALLOCA_FLAG(use_heap)
+-
+- if (var_len > 5 &&
+- var[0] == 'H' &&
+- var[1] == 'T' &&
+- var[2] == 'T' &&
+- var[3] == 'P' &&
+- var[4] == '_') {
+-
+- var_len -= 5;
+- p = var + 5;
+- var = str = do_alloca(var_len + 1, use_heap);
+- *str++ = *p++;
+- while (*p) {
+- if (*p == '_') {
+- *str++ = '-';
+- p++;
+- if (*p) {
+- *str++ = *p++;
+- }
+- } else if (*p >= 'A' && *p <= 'Z') {
+- *str++ = (*p++ - 'A' + 'a');
+- } else {
+- *str++ = *p++;
+- }
+- }
+- *str = 0;
+- } else if (var_len == sizeof("CONTENT_TYPE")-1 &&
+- memcmp(var, "CONTENT_TYPE", sizeof("CONTENT_TYPE")-1) == 0) {
+- var = "Content-Type";
+- } else if (var_len == sizeof("CONTENT_LENGTH")-1 &&
+- memcmp(var, "CONTENT_LENGTH", sizeof("CONTENT_LENGTH")-1) == 0) {
+- var = "Content-Length";
+- } else {
+- return;
+- }
+- add_assoc_stringl_ex(return_value, var, var_len, val, val_len);
+- if (str) {
+- free_alloca(var, use_heap);
+- }
+-}
+-/* }}} */
+-
+ PHP_FUNCTION(apache_request_headers) /* {{{ */
+ {
+ if (zend_parse_parameters_none()) {
+@@ -1649,7 +1601,7 @@ PHP_FUNCTION(apache_request_headers) /*
+ if (fcgi_is_fastcgi()) {
+ fcgi_request *request = (fcgi_request*) SG(server_context);
+
+- fcgi_loadenv(request, add_request_header, return_value);
++ fcgi_loadenv(request, sapi_add_request_header, return_value);
+ } else {
+ char buf[128];
+ char **env, *p, *q, *var, *val, *t = buf;
+diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c
+index 3256660..e815be4 100644
+--- a/sapi/fpm/fpm/fpm_main.c
++++ b/sapi/fpm/fpm/fpm_main.c
+@@ -1533,6 +1533,10 @@ PHP_FUNCTION(fastcgi_finish_request) /* {{{ */
+ {
+ fcgi_request *request = (fcgi_request*) SG(server_context);
+
++ if (zend_parse_parameters_none() == FAILURE) {
++ return;
++ }
++
+ if (!fcgi_is_closed(request)) {
+ php_output_end_all();
+ php_header();
+@@ -1547,8 +1551,27 @@ PHP_FUNCTION(fastcgi_finish_request) /* {{{ */
+ }
+ /* }}} */
+
++ZEND_BEGIN_ARG_INFO(cgi_fcgi_sapi_no_arginfo, 0)
++ZEND_END_ARG_INFO()
++
++PHP_FUNCTION(apache_request_headers) /* {{{ */
++{
++ fcgi_request *request;
++
++ if (zend_parse_parameters_none() == FAILURE) {
++ return;
++ }
++
++ array_init(return_value);
++ if ((request = (fcgi_request*) SG(server_context))) {
++ fcgi_loadenv(request, sapi_add_request_header, return_value);
++ }
++} /* }}} */
++
+ static const zend_function_entry cgi_fcgi_sapi_functions[] = {
+- PHP_FE(fastcgi_finish_request, NULL)
++ PHP_FE(fastcgi_finish_request, cgi_fcgi_sapi_no_arginfo)
++ PHP_FE(apache_request_headers, cgi_fcgi_sapi_no_arginfo)
++ PHP_FALIAS(getallheaders, apache_request_headers, cgi_fcgi_sapi_no_arginfo)
+ PHP_FE_END
+ };
+
+--
+2.1.4
+
diff --git a/php.spec b/php.spec
index 92cb995..b9f754a 100644
--- a/php.spec
+++ b/php.spec
@@ -126,7 +126,7 @@
Summary: PHP scripting language for creating dynamic web sites
Name: %{?scl_prefix}php
Version: %{upver}%{?rcver:~%{rcver}}
-Release: 1%{?dist}
+Release: 2%{?dist}
# All files licensed under PHP version 3.01, except
# Zend is licensed under Zend
# TSRM is licensed under BSD
@@ -178,6 +178,8 @@ Patch45: php-7.1.15-ldap_r.patch
Patch47: php-5.6.3-phpinfo.patch
# Automatically load OpenSSL configuration file
Patch48: php-7.1.9-openssl-load-config.patch
+# getallheaders for FPM backported from 7.3
+Patch49: php-7.1.24-getallheaders.patch
# RC Patch
Patch91: php-5.6.3-oci8conf.patch
@@ -900,6 +902,7 @@ support for JavaScript Object Notation (JSON) to PHP.
%endif
%patch47 -p1 -b .phpinfo
%patch48 -p1 -b .loadconf
+%patch49 -p1 -b .getallheaders
%patch91 -p1 -b .remi-oci8
@@ -1844,6 +1847,9 @@ fi
%changelog
+* Wed Oct 24 2018 Remi Collet <remi@remirepo.net> - 7.1.24~RC1-2
+- FPM: add getallheaders, backported from 7.3
+
* Wed Oct 24 2018 Remi Collet <remi@remirepo.net> - 7.1.24~RC1-1
- update to 7.1.24RC1