[PHP4BETA] CVS update: php4
| From: | zeev | Date: | Tue, 11 May 1999 20:38:15 +0000 |
| Subject: | [PHP4BETA] CVS update: php4 | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-776@lists.php.net to get a copy of this message | ||
Date: Tuesday May 11, 1999 @ 16:38
Author: zeev
Update of /repository/php4
In directory php:/tmp/cvs-serv15443
Modified Files:
SAPI.c SAPI.h cgi_main.c php4dllts.dsp
Log Message:
* Finally commit that -q patch
* Refine SAPI built in header support
* Use DllMain() in ISAPI to clean after threads and initialize tsrm/sapi as soon as possible.
Index: php4/SAPI.c
diff -u php4/SAPI.c:1.16 php4/SAPI.c:1.17
--- php4/SAPI.c:1.16 Tue May 11 14:36:35 1999
+++ php4/SAPI.c Tue May 11 16:38:12 1999
@@ -91,14 +91,14 @@
zend_llist_init(&SG(sapi_headers).headers, sizeof(sapi_header_struct), (void (*)(void *))
sapi_free_header, 0);
SG(sapi_headers).send_default_content_type = 1;
SG(sapi_headers).http_response_code = 200;
+ SG(sapi_headers).http_status_line = NULL;
SG(headers_sent) = 0;
SG(read_post_bytes) = 0;
+ SG(request_info).post_data = NULL;
if (SG(server_context)) {
if (SG(request_info).request_method
&& !strcmp(SG(request_info).request_method, "POST")) {
sapi_read_post_data(SLS_C);
- } else {
- SG(request_info).post_data = NULL;
}
SG(request_info).cookie_data = sapi_module.read_cookies(SLS_C);
}
@@ -108,9 +108,17 @@
SAPI_API void sapi_deactivate(SLS_D)
{
zend_llist_destroy(&SG(sapi_headers).headers);
- if (SG(server_context) && SG(request_info).post_data) {
+ if (SG(request_info).post_data) {
efree(SG(request_info).post_data);
}
+ if (SG(server_context)) {
+ if (SG(request_info).auth_user) {
+ efree(SG(request_info).auth_user);
+ }
+ if (SG(request_info).auth_password) {
+ efree(SG(request_info).auth_password);
+ }
+ }
}
@@ -133,15 +141,22 @@
sapi_header.header = header_line;
sapi_header.header_len = header_line_len;
- colon_offset = strchr(header_line, ':');
- if (colon_offset) {
- *colon_offset = 0;
- if (!STRCASECMP(header_line, "Content-Type")) {
- SG(sapi_headers).send_default_content_type = 0;
- } else if (!STRCASECMP(header_line, "Location")) {
- SG(sapi_headers).http_response_code = 302; /* redirect */
+ /* Check the header for a few cases that we have special support for in SAPI */
+ if (!memcmp(header_line, "HTTP/", 5)) {
+ SG(sapi_headers).http_status_line = header_line;
+ } else {
+ colon_offset = strchr(header_line, ':');
+ if (colon_offset) {
+ *colon_offset = 0;
+ if (!STRCASECMP(header_line, "Content-Type")) {
+ SG(sapi_headers).send_default_content_type = 0;
+ } else if (!STRCASECMP(header_line, "Location")) {
+ SG(sapi_headers).http_response_code = 302; /* redirect */
+ } else if (!STRCASECMP(header_line, "WWW-Authenticate")) { /* HTTP Authentication */
+ SG(sapi_headers).http_response_code = 401; /* authentication-required */
+ }
+ *colon_offset = ':';
}
- *colon_offset = ':';
}
if (sapi_module.header_handler) {
@@ -182,6 +197,14 @@
return SUCCESS;
break;
case SAPI_HEADER_DO_SEND:
+ if (SG(sapi_headers).http_status_line) {
+ sapi_header_struct http_status_line;
+
+ http_status_line.header = SG(sapi_headers).http_status_line;
+ http_status_line.header_len = strlen(SG(sapi_headers).http_status_line);
+ sapi_module.send_header(&http_status_line, SG(server_context));
+ efree(SG(sapi_headers).http_status_line);
+ }
if (SG(sapi_headers).send_default_content_type) {
sapi_module.send_header(&default_header, SG(server_context));
}
Index: php4/SAPI.h
diff -u php4/SAPI.h:1.12 php4/SAPI.h:1.13
--- php4/SAPI.h:1.12 Sun May 9 14:40:59 1999
+++ php4/SAPI.h Tue May 11 16:38:13 1999
@@ -27,6 +27,7 @@
zend_llist headers;
int http_response_code;
unsigned char send_default_content_type;
+ char *http_status_line;
} sapi_headers_struct;
@@ -49,6 +50,10 @@
char *content_type;
unsigned char headers_only;
+
+ /* for HTTP authentication */
+ char *auth_user;
+ char *auth_password;
} sapi_request_info;
Index: php4/cgi_main.c
diff -u php4/cgi_main.c:1.12 php4/cgi_main.c:1.13
--- php4/cgi_main.c:1.12 Mon May 10 16:41:42 1999
+++ php4/cgi_main.c Tue May 11 16:38:13 1999
@@ -170,6 +170,10 @@
}
SG(request_info).content_type = getenv("CONTENT_TYPE");
SG(request_info).content_length = (content_length?atoi(content_length):0);
+
+ /* CGI does not support HTTP authentication */
+ SG(request_info).auth_user = NULL;
+ SG(request_info).auth_password = NULL;
}
@@ -182,6 +186,7 @@
char *_cgi_filename=NULL;
int _cgi_started=0;
int behavior=PHP_MODE_STANDARD;
+ int no_headers=0;
#if SUPPORT_INTERACTIVE
int interactive=0;
#endif
@@ -273,11 +278,14 @@
return FAILURE;
}
}
+ if (no_headers) {
+ SG(headers_sent) = 1;
+ }
_cgi_started=1;
_cgi_filename = estrdup(optarg);
/* break missing intentionally */
case 'q':
- php3_noheader();
+ no_headers = 1;
break;
case 'v':
if (!_cgi_started) {
@@ -286,6 +294,9 @@
return FAILURE;
}
}
+ if (no_headers) {
+ SG(headers_sent) = 1;
+ }
php3_printf("%s\n", PHP_VERSION);
exit(1);
break;
@@ -296,6 +307,9 @@
return FAILURE;
}
}
+ if (no_headers) {
+ SG(headers_sent) = 1;
+ }
_cgi_started=1;
php3_TreatHeaders();
_php3_info();
@@ -323,8 +337,8 @@
break;
case 'h':
case '?':
- php3_noheader();
zend_output_startup();
+ SG(headers_sent) = 1;
php_cgi_usage(argv[0]);
exit(1);
break;
@@ -343,6 +357,9 @@
php_module_shutdown();
return FAILURE;
}
+ }
+ if (no_headers) {
+ SG(headers_sent) = 1;
}
file_handle.filename = "-";
file_handle.type = ZEND_HANDLE_FP;
Index: php4/php4dllts.dsp
diff -u php4/php4dllts.dsp:1.5 php4/php4dllts.dsp:1.6
--- php4/php4dllts.dsp:1.5 Tue May 4 16:27:30 1999
+++ php4/php4dllts.dsp Tue May 11 16:38:13 1999
@@ -211,6 +211,10 @@
# End Source File
# Begin Source File
+SOURCE=.\php_regex.h
+# End Source File
+# Begin Source File
+
SOURCE=.\ext\standard\quot_print.h
# End Source File
# Begin Source File
--
PHP 4 Beta