diff options
Diffstat (limited to 'ext/standard/head.c')
| -rw-r--r-- | ext/standard/head.c | 123 |
1 files changed, 0 insertions, 123 deletions
diff --git a/ext/standard/head.c b/ext/standard/head.c index 493703e772..23f5f58efb 100644 --- a/ext/standard/head.c +++ b/ext/standard/head.c @@ -58,133 +58,10 @@ PHP_RINIT_FUNCTION(head) } -#if 0 -/* Adds header information */ -void php4i_add_header_information(char *header_information, uint header_length) -{ - char *r; -#if APACHE - char *rr = NULL; - char *temp = NULL; - long myuid = 0L; - char temp2[32]; - request_rec *req; - SLS_FETCH(); - - req = ((request_rec *) SG(server_context)); -#endif - - if (php_header_printed == 1) { -#if DEBUG - php_error(E_WARNING, "Cannot add more header information - the header was already sent " - "(header information may be added only before any output is generated from the script - " - "check for text or whitespace outside PHP tags, or calls to functions that output text)"); -#endif - return; /* too late, already sent */ - } -#if APACHE - /* - * Not entirely sure this is the right way to support the header - * command in the Apache module. Comments? - */ - r = strchr(header_information, ':'); - if (r) { - *r = '\0'; - if (!strcasecmp(header_information, "Content-type")) { - if (*(r + 1) == ' ') - req->content_type = pstrdup(req->pool,r + 2); - else - req->content_type = pstrdup(req->pool,r + 1); - cont_type = (char *) req->content_type; - } else { - if (*(r + 1) == ' ') { - rr = r + 2; - } else { - rr = r + 1; - } - if (PG(safe_mode) && (!strcasecmp(header_information, "WWW-authenticate"))) { - myuid = php_getuid(); - sprintf(temp2, "realm=\"%ld ", myuid); /* SAFE */ - temp = php_reg_replace("realm=\"", temp2, rr, 1, 0); - if (!strcmp(temp, rr)) { - sprintf(temp2, "realm=%ld", myuid); /* SAFE */ - temp = php_reg_replace("realm=", temp2, rr, 1, 0); - if (!strcmp(temp, rr)) { - sprintf(temp2, " realm=%ld", myuid); /* SAFE */ - temp = php_reg_replace("$", temp2, rr, 0, 0); - } - } - table_set(req->headers_out, header_information, temp); - } else - table_set(req->headers_out, header_information, rr); - } - if (!strcasecmp(header_information, "location")) { - req->status = REDIRECT; - } - *r = ':'; - php_header_printed = 2; - } - if (!strncasecmp(header_information, "http/", 5)) { - if (strlen(header_information) > 9) { - req->status = atoi(&((header_information)[9])); - } - /* Use a pstrdup here to get the memory straight from Apache's per-request pool to - * avoid having our own memory manager complain about this memory not being freed - * because it really shouldn't be freed until the end of the request and it isn't - * easy for us to figure out when we allocated it vs. when something else might have. - */ - req->status_line = pstrdup(req->pool,&((header_information)[9])); - } -#else - r = strchr(header_information, ':'); - if (r) { - *r = '\0'; - if (!strcasecmp(header_information, "Content-type")) { - if (cont_type) efree(cont_type); - cont_type = estrdup(r + 1); -#if 0 /*WIN32|WINNT / *M$ does us again*/ - if (!strcmp(cont_type," text/html")){ - *r=':'; - PUTS_H(header_information); - PUTS_H("\015\012"); - } -#endif - } else { - *r = ':'; -#if USE_SAPI - { - char *tempstr=emalloc(strlen(header_information)+2); - - sprintf(tempstr,"%s\015\012",tempstr); - sapi_rqst->header(sapi_rqst->scid,tempstr); - efree(tempstr); - } -#else - PUTS_H(header_information); - PUTS_H("\015\012"); -#endif - } - } else { -#if USE_SAPI - { - char *tempstr=emalloc(strlen(header_information)+2); - sprintf(tempstr,"%s\015\012",tempstr); - sapi_rqst->header(sapi_rqst->scid,tempstr); - efree(tempstr); - } -#else - PUTS_H(header_information); - PUTS_H("\015\012"); -#endif - } -#endif -} -#else void php4i_add_header_information(char *header_information, uint header_length) { sapi_add_header(header_information, header_length); } -#endif /* Implementation of the language Header() function */ |
