From c95ec82b03c0479e44de9884601dd48592dcc016 Mon Sep 17 00:00:00 2001 From: "roberto@precise64" Date: Fri, 24 Feb 2012 12:12:19 +0100 Subject: [PATCH] a series of php/cgi fixes --- info_uwsgi.php | 1 + plugins/cgi/cgi_plugin.c | 4 ++-- plugins/php/php_plugin.c | 8 +++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/info_uwsgi.php b/info_uwsgi.php index 8858b3a0..d06a3cdd 100644 --- a/info_uwsgi.php +++ b/info_uwsgi.php @@ -3,6 +3,7 @@ workerd id:
master pid:
uri:
+docroot:
diff --git a/plugins/cgi/cgi_plugin.c b/plugins/cgi/cgi_plugin.c index 707a9e96..5bd86564 100644 --- a/plugins/cgi/cgi_plugin.c +++ b/plugins/cgi/cgi_plugin.c @@ -66,13 +66,13 @@ struct uwsgi_option uwsgi_cgi_options[] = { void uwsgi_cgi_404(struct wsgi_request *wsgi_req) { wsgi_req->status = 404; - wsgi_req->headers_size += wsgi_req->socket->proto_write(wsgi_req, "HTTP/1.0 404 Not Found\r\n\r\nNot Found", 35); + wsgi_req->headers_size += wsgi_req->socket->proto_write(wsgi_req, "HTTP/1.0 404 Not Found\r\nContent-Type: text/plain\r\n\r\nNot Found", 61); } void uwsgi_cgi_403(struct wsgi_request *wsgi_req) { wsgi_req->status = 403; - wsgi_req->headers_size += wsgi_req->socket->proto_write(wsgi_req, "HTTP/1.0 403 Forbidden\r\n\r\nForbidden", 35); + wsgi_req->headers_size += wsgi_req->socket->proto_write(wsgi_req, "HTTP/1.0 403 Forbidden\r\nContent-Type: text/plain\r\n\r\nForbidden", 61); } diff --git a/plugins/php/php_plugin.c b/plugins/php/php_plugin.c index c14107c1..0c1c4712 100644 --- a/plugins/php/php_plugin.c +++ b/plugins/php/php_plugin.c @@ -102,13 +102,13 @@ static int sapi_uwsgi_ub_write(const char *str, uint str_length TSRMLS_DC) void uwsgi_php_404(struct wsgi_request *wsgi_req) { wsgi_req->status = 404; - wsgi_req->headers_size += wsgi_req->socket->proto_write(wsgi_req, "HTTP/1.0 404 Not Found\r\n\r\nNot Found", 35); + wsgi_req->headers_size += wsgi_req->socket->proto_write(wsgi_req, "HTTP/1.0 404 Not Found\r\nContent-Type: text/plain\r\n\r\nNot Found", 61); } void uwsgi_php_403(struct wsgi_request *wsgi_req) { wsgi_req->status = 403; - wsgi_req->headers_size += wsgi_req->socket->proto_write(wsgi_req, "HTTP/1.0 403 Forbidden\r\n\r\nForbidden", 35); + wsgi_req->headers_size += wsgi_req->socket->proto_write(wsgi_req, "HTTP/1.0 403 Forbidden\r\nContent-Type: text/plain\r\n\r\nForbidden", 61); } @@ -274,7 +274,6 @@ static void sapi_uwsgi_register_variables(zval *track_vars_array TSRMLS_DC) php_register_variable_safe("DOCUMENT_ROOT", wsgi_req->document_root, wsgi_req->document_root_len, track_vars_array TSRMLS_CC); - if (wsgi_req->path_info_len) { char *path_translated = ecalloc(1, (wsgi_req->file_len - wsgi_req->script_name_len) + wsgi_req->path_info_len + 1); @@ -712,8 +711,7 @@ int uwsgi_php_request(struct wsgi_request *wsgi_req) { if (!wsgi_req->document_root) { - uwsgi_get_var(wsgi_req, (char *) "DOCUMENT_ROOT", 13, &wsgi_req->document_root_len); - + wsgi_req->document_root = uwsgi_get_var(wsgi_req, (char *) "DOCUMENT_ROOT", 13, &wsgi_req->document_root_len); if (!wsgi_req->document_root) { wsgi_req->document_root = uwsgi.cwd; wsgi_req->document_root_len = strlen(uwsgi.cwd);