CVS update: php3/functions

From: Date: Mon, 26 Oct 1998 05:31:46 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-2019@lists.php.net to get a copy of this message
Date: Monday October 26, 1998 @ 0:31 Author: zeev Update of /repository/php3/functions In directory asf:/u2/tmp/cvs-serv20093/functions Modified Files: head.c head.h Log Message: Reverse the zlib patch. Index: php3/functions/head.c diff -c php3/functions/head.c:1.108 php3/functions/head.c:1.109 *** php3/functions/head.c:1.108 Sun Oct 25 16:34:52 1998 --- php3/functions/head.c Mon Oct 26 00:31:46 1998 *************** *** 26,32 **** | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> | +----------------------------------------------------------------------+ */ ! /* $Id: head.c,v 1.108 1998/10/25 21:34:52 cschneid Exp $ */ #ifdef THREAD_SAFE #include "tls.h" #endif --- 26,32 ---- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> | +----------------------------------------------------------------------+ */ ! /* $Id: head.c,v 1.109 1998/10/26 05:31:46 zeev Exp $ */ #ifdef THREAD_SAFE #include "tls.h" #endif *************** *** 86,103 **** /* Implementation of the language Header() function */ void php3_Header(INTERNAL_FUNCTION_PARAMETERS) { - pval *arg1; - TLS_VARS; - - if (getParameters(ht, 1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string(arg1); - php3_addheaderline(arg1->value.str.val); - } - - PHPAPI void php3_addheaderline(char *headerline) - { char *r; #if APACHE char *rr = NULL; --- 86,91 ---- *************** *** 105,112 **** --- 93,107 ---- long myuid = 0L; char temp2[32]; #endif + pval *arg1; TLS_VARS; + + + if (getParameters(ht, 1, &arg1) == FAILURE) { + WRONG_PARAM_COUNT; + } + convert_to_string(arg1); if (GLOBAL(php3_HeaderPrinted) == 1) { #if DEBUG php3_error(E_WARNING, "Cannot add more header information - the header was already sent " *************** *** 120,129 **** * Not entirely sure this is the right way to support the header * command in the Apache module. Comments? */ ! r = strchr(headerline, ':'); if (r) { *r = '\0'; ! if (!strcasecmp(headerline, "Content-type")) { if (*(r + 1) == ' ') GLOBAL(php3_rqst)->content_type = pstrdup(GLOBAL(php3_rqst)->pool,r + 2); else --- 115,124 ---- * Not entirely sure this is the right way to support the header * command in the Apache module. Comments? */ ! r = strchr(arg1->value.str.val, ':'); if (r) { *r = '\0'; ! if (!strcasecmp(arg1->value.str.val, "Content-type")) { if (*(r + 1) == ' ') GLOBAL(php3_rqst)->content_type = pstrdup(GLOBAL(php3_rqst)->pool,r + 2); else *************** *** 134,140 **** rr = r + 2; else rr = r + 1; ! if (php3_ini.safe_mode && (!strcasecmp(headerline, "WWW-authenticate"))) { myuid = _php3_getuid(); sprintf(temp2, "realm=\"%ld ", myuid); /* SAFE */ temp = _php3_regreplace("realm=\"", temp2, rr, 1, 0); --- 129,135 ---- rr = r + 2; else rr = r + 1; ! if (php3_ini.safe_mode && (!strcasecmp(arg1->value.str.val, "WWW-authenticate"))) { myuid = _php3_getuid(); sprintf(temp2, "realm=\"%ld ", myuid); /* SAFE */ temp = _php3_regreplace("realm=\"", temp2, rr, 1, 0); *************** *** 146,183 **** temp = _php3_regreplace("$", temp2, rr, 0, 0); } } ! table_set(GLOBAL(php3_rqst)->headers_out, headerline, temp); } else ! table_set(GLOBAL(php3_rqst)->headers_out, headerline, rr); } ! if (!strcasecmp(headerline, "location")) { GLOBAL(php3_rqst)->status = REDIRECT; } *r = ':'; GLOBAL(php3_HeaderPrinted) = 2; } ! if (!strncasecmp(headerline, "http/", 5)) { ! if (strlen(headerline) > 9) { ! GLOBAL(php3_rqst)->status = atoi(&(headerline[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. */ ! GLOBAL(php3_rqst)->status_line = pstrdup(GLOBAL(php3_rqst)->pool,&(headerline[9])); } #else ! r = strchr(headerline, ':'); if (r) { *r = '\0'; ! if (!strcasecmp(headerline, "Content-type")) { if (GLOBAL(cont_type)) efree(GLOBAL(cont_type)); GLOBAL(cont_type) = estrdup(r + 1); #if 0 /*WIN32|WINNT / *M$ does us again*/ if (!strcmp(GLOBAL(cont_type)," text/html")){ *r=':'; ! PUTS(headerline); PUTS("\015\012"); } #endif --- 141,178 ---- temp = _php3_regreplace("$", temp2, rr, 0, 0); } } ! table_set(GLOBAL(php3_rqst)->headers_out, arg1->value.str.val, temp); } else ! table_set(GLOBAL(php3_rqst)->headers_out, arg1->value.str.val, rr); } ! if (!strcasecmp(arg1->value.str.val, "location")) { GLOBAL(php3_rqst)->status = REDIRECT; } *r = ':'; GLOBAL(php3_HeaderPrinted) = 2; } ! if (!strncasecmp(arg1->value.str.val, "http/", 5)) { ! if (strlen(arg1->value.str.val) > 9) { ! GLOBAL(php3_rqst)->status = atoi(&((arg1->value.str.val)[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. */ ! GLOBAL(php3_rqst)->status_line = pstrdup(GLOBAL(php3_rqst)->pool,&((arg1->value.str.val)[9])); } #else ! r = strchr(arg1->value.str.val, ':'); if (r) { *r = '\0'; ! if (!strcasecmp(arg1->value.str.val, "Content-type")) { if (GLOBAL(cont_type)) efree(GLOBAL(cont_type)); GLOBAL(cont_type) = estrdup(r + 1); #if 0 /*WIN32|WINNT / *M$ does us again*/ if (!strcmp(GLOBAL(cont_type)," text/html")){ *r=':'; ! PUTS(arg1->value.str.val); PUTS("\015\012"); } #endif *************** *** 185,191 **** *r = ':'; #if USE_SAPI { ! char *tempstr=emalloc(strlen(headerline)+2); sprintf(tempstr,"%s\015\012",tempstr); GLOBAL(sapi_rqst)->header(GLOBAL(sapi_rqst)->scid,tempstr); --- 180,186 ---- *r = ':'; #if USE_SAPI { ! char *tempstr=emalloc(strlen(arg1->value.str.val)+2); sprintf(tempstr,"%s\015\012",tempstr); GLOBAL(sapi_rqst)->header(GLOBAL(sapi_rqst)->scid,tempstr); *************** *** 193,202 **** } #else /* CGI BINARY or FHTTPD */ #if FHTTPD ! php3_fhttpd_puts_header(headerline); php3_fhttpd_puts_header("\r\n"); #else ! PUTS(headerline); PUTS("\015\012"); #endif #endif/* end if SAPI */ --- 188,197 ---- } #else /* CGI BINARY or FHTTPD */ #if FHTTPD ! php3_fhttpd_puts_header(arg1->value.str.val); php3_fhttpd_puts_header("\r\n"); #else ! PUTS(arg1->value.str.val); PUTS("\015\012"); #endif #endif/* end if SAPI */ *************** *** 204,220 **** } else { #if USE_SAPI { ! char *tempstr=emalloc(strlen(headerline)+2); sprintf(tempstr,"%s\015\012",tempstr); GLOBAL(sapi_rqst)->header(GLOBAL(sapi_rqst)->scid,tempstr); efree(tempstr); } #else /* CGI BINARY or FHTTPD */ #if FHTTPD ! php3_fhttpd_puts_header(headerline); php3_fhttpd_puts_header("\r\n"); #else ! PUTS(headerline); PUTS("\015\012"); #endif #endif /* endif SAPI */ --- 199,215 ---- } else { #if USE_SAPI { ! char *tempstr=emalloc(strlen(arg1->value.str.val)+2); sprintf(tempstr,"%s\015\012",tempstr); GLOBAL(sapi_rqst)->header(GLOBAL(sapi_rqst)->scid,tempstr); efree(tempstr); } #else /* CGI BINARY or FHTTPD */ #if FHTTPD ! php3_fhttpd_puts_header(arg1->value.str.val); php3_fhttpd_puts_header("\r\n"); #else ! PUTS(arg1->value.str.val); PUTS("\015\012"); #endif #endif /* endif SAPI */ Index: php3/functions/head.h diff -c php3/functions/head.h:1.21 php3/functions/head.h:1.22 *** php3/functions/head.h:1.21 Sun Oct 25 16:34:53 1998 --- php3/functions/head.h Mon Oct 26 00:31:46 1998 *************** *** 57,63 **** extern void php3_SetCookie(INTERNAL_FUNCTION_PARAMETERS); extern void php3_noheader(void); - extern PHPAPI void php3_addheaderline(char *headerline); extern PHPAPI int php3_header(void); extern void php3_noheader(void); extern int php3_headers_unsent(void); --- 57,62 ---- -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#2019) next »