diff options
| author | Ondřej Surý <ondrej@sury.org> | 2013-02-25 16:29:09 +0100 |
|---|---|---|
| committer | Ondřej Surý <ondrej@sury.org> | 2013-02-25 16:29:09 +0100 |
| commit | 7ad1f708d5748e36de4b51088b377907e5ea01e7 (patch) | |
| tree | 3f8a4c034747c921baf3b4118e2cc6ccc875fe43 /sapi | |
| parent | 54098cf044025ec5965b8ea9c84750f9631d85b6 (diff) | |
| download | php-7ad1f708d5748e36de4b51088b377907e5ea01e7.tar.gz | |
Imported Upstream version 5.5.0~alpha5upstream/5.5.0_alpha5
Diffstat (limited to 'sapi')
| -rw-r--r-- | sapi/cgi/cgi_main.c | 4 | ||||
| -rw-r--r-- | sapi/cli/php_cli_server.c | 34 | ||||
| -rw-r--r-- | sapi/fpm/fpm/fpm_main.c | 4 |
3 files changed, 25 insertions, 17 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index fbb9f512d..9e6b74ac6 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -384,12 +384,16 @@ static const http_error http_error_codes[] = { {413, "Request Entity Too Large"}, {414, "Request-URI Too Large"}, {415, "Unsupported Media Type"}, + {428, "Precondition Required"}, + {429, "Too Many Requests"}, + {431, "Request Header Fields Too Large"}, {500, "Internal Server Error"}, {501, "Not Implemented"}, {502, "Bad Gateway"}, {503, "Service Unavailable"}, {504, "Gateway Time-out"}, {505, "HTTP Version not supported"}, + {511, "Network Authentication Required"}, {0, NULL} }; diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index 700a49525..1d2ceff69 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -236,12 +236,16 @@ static php_cli_server_http_reponse_status_code_pair status_map[] = { { 415, "Unsupported Media Type" }, { 416, "Requested Range Not Satisfiable" }, { 417, "Expectation Failed" }, + { 428, "Precondition Required" }, + { 429, "Too Many Requests" }, + { 431, "Request Header Fields Too Large" }, { 500, "Internal Server Error" }, { 501, "Not Implemented" }, { 502, "Bad Gateway" }, { 503, "Service Unavailable" }, { 504, "Gateway Timeout" }, { 505, "HTTP Version Not Supported" }, + { 511, "Network Authentication Required" }, }; static php_cli_server_http_reponse_status_code_pair template_map[] = { @@ -712,10 +716,9 @@ static void php_cli_server_poller_remove(php_cli_server_poller *poller, int mode if (fd == poller->max_fd) { while (fd > 0) { fd--; - if (((unsigned int *)&poller->rfds)[fd / (8 * sizeof(unsigned int))] || ((unsigned int *)&poller->wfds)[fd / (8 * sizeof(unsigned int))]) { + if (PHP_SAFE_FD_ISSET(fd, &poller->rfds) || PHP_SAFE_FD_ISSET(fd, &poller->wfds)) { break; } - fd -= fd % (8 * sizeof(unsigned int)); } poller->max_fd = fd; } @@ -774,23 +777,20 @@ static int php_cli_server_poller_iter_on_active(php_cli_server_poller *poller, v } #else - php_socket_t fd = 0; + php_socket_t fd; const php_socket_t max_fd = poller->max_fd; - const unsigned int *pr = (unsigned int *)&poller->active.rfds, - *pw = (unsigned int *)&poller->active.wfds, - *e = pr + (max_fd + (8 * sizeof(unsigned int)) - 1) / (8 * sizeof(unsigned int)); - unsigned int mask; - while (pr < e && fd <= max_fd) { - for (mask = 1; mask; mask <<= 1, fd++) { - int events = (*pr & mask ? POLLIN: 0) | (*pw & mask ? POLLOUT: 0); - if (events) { - if (SUCCESS != callback(opaque, fd, events)) { - retval = FAILURE; - } - } + + for (fd=0 ; fd<=max_fd ; fd++) { + if (PHP_SAFE_FD_ISSET(fd, &poller->active.rfds)) { + if (SUCCESS != callback(opaque, fd, POLLIN)) { + retval = FAILURE; + } + } + if (PHP_SAFE_FD_ISSET(fd, &poller->active.wfds)) { + if (SUCCESS != callback(opaque, fd, POLLOUT)) { + retval = FAILURE; + } } - pr++; - pw++; } #endif return retval; diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index 40810f00b..61088c465 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -375,12 +375,16 @@ static const http_error http_error_codes[] = { {413, "Request Entity Too Large"}, {414, "Request-URI Too Large"}, {415, "Unsupported Media Type"}, + {428, "Precondition Required"}, + {429, "Too Many Requests"}, + {431, "Request Header Fields Too Large"}, {500, "Internal Server Error"}, {501, "Not Implemented"}, {502, "Bad Gateway"}, {503, "Service Unavailable"}, {504, "Gateway Time-out"}, {505, "HTTP Version not supported"}, + {511, "Network Authentication Required"}, {0, NULL} }; |
