|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ?? 1999, Version 4.0 Beta 3
+- Fixed header("HTTP/..."); behaviour (Sascha)
+- Improved UNIX build system. Now utilizes libtool (Sascha)
- Upgrade some more internal functions to use new Zend function API. (Thies,
Zend library)
- Fixed backwards incompatibility with ereg() (Thies)
}
}
+static int sapi_extract_response_code(const char *header_line)
+{
+ int code = 200;
+ const char *ptr;
+
+ for (ptr = header_line; *ptr; ptr++) {
+ if (*ptr == ' ' && *(ptr + 1) != ' ') {
+ code = atoi(ptr + 1);
+ break;
+ }
+ }
+
+ return code;
+}
/* This function expects a *duplicated* string, that was previously emalloc()'d.
* Pointers sent to this functions will be automatically freed by the framework.
/* Check the header for a few cases that we have special support for in SAPI */
if (header_line_len>=5
&& !memcmp(header_line, "HTTP/", 5)) {
+ /* filter out the response code */
+ SG(sapi_headers).http_response_code = sapi_extract_response_code(header_line);
SG(sapi_headers).http_status_line = header_line;
return SUCCESS;
} else {
SAPI_API int sapi_send_headers()
{
int retval;
+ int ret = FAILURE;
sapi_header_struct default_header = { SAPI_DEFAULT_CONTENT_TYPE, sizeof(SAPI_DEFAULT_CONTENT_TYPE)-1 };
SLS_FETCH();
switch (retval) {
case SAPI_HEADER_SENT_SUCCESSFULLY:
SG(headers_sent) = 1;
- return SUCCESS;
+ ret = FAILURE;
break;
case SAPI_HEADER_DO_SEND:
if (SG(sapi_headers).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));
zend_llist_apply_with_argument(&SG(sapi_headers).headers, (void (*)(void *, void *)) sapi_module.send_header, SG(server_context));
sapi_module.send_header(NULL, SG(server_context));
SG(headers_sent) = 1;
- return SUCCESS;
+ ret = SUCCESS;
break;
case SAPI_HEADER_SEND_FAILED:
- return FAILURE;
+ ret = FAILURE;
break;
}
- return FAILURE;
+
+ if (SG(sapi_headers).http_status_line) {
+ efree(SG(sapi_headers).http_status_line);
+ }
+
+ return ret;
}
respectively. Additionally, the following m4 macros can be used to
influence what is created during "make":
-PHP_BUILD_SHARED -- build shared target libs/php_lib.so
-PHP_BUILD_STATIC -- build static target libs/php_lib.a
+PHP_BUILD_SHARED -- build shared target libs/libphp4.so
+PHP_BUILD_STATIC -- build static target libs/libphp4.a
PHP_BUILD_PROGRAM -- build executable php
(paths relative to top build dir)