mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Thread-safe header_is_being_sent
This commit is contained in:
@@ -236,17 +236,17 @@ PHPAPI int php3_header(void)
|
||||
#if APACHE || defined(USE_SAPI) || FHTTPD
|
||||
char *tempstr;
|
||||
#endif
|
||||
TLS_VARS;
|
||||
PLS_FETCH();
|
||||
|
||||
if (GLOBAL(header_is_being_sent)) {
|
||||
if (PG(header_is_being_sent)) {
|
||||
return 0;
|
||||
} else {
|
||||
GLOBAL(header_is_being_sent) = 1;
|
||||
PG(header_is_being_sent) = 1;
|
||||
}
|
||||
|
||||
#if APACHE
|
||||
if (!GLOBAL(php3_rqst)) { /* we're not in a request, allow output */
|
||||
GLOBAL(header_is_being_sent) = 0;
|
||||
PG(header_is_being_sent) = 0;
|
||||
return 1;
|
||||
}
|
||||
if ((GLOBAL(php3_PrintHeader) && !GLOBAL(php3_HeaderPrinted)) || (GLOBAL(php3_PrintHeader) && GLOBAL(php3_HeaderPrinted) == 2)) {
|
||||
@@ -324,7 +324,7 @@ TLS_VARS;
|
||||
send_http_header(GLOBAL(php3_rqst));
|
||||
if (GLOBAL(php3_rqst)->header_only) {
|
||||
set_header_request(1);
|
||||
GLOBAL(header_is_being_sent) = 0;
|
||||
PG(header_is_being_sent) = 0;
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
@@ -382,7 +382,7 @@ TLS_VARS;
|
||||
GLOBAL(header_called) = 1;
|
||||
}
|
||||
#endif
|
||||
GLOBAL(header_is_being_sent) = 0;
|
||||
PG(header_is_being_sent) = 0;
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
1
main.h
1
main.h
@@ -55,7 +55,6 @@ extern void php3_module_shutdown();
|
||||
extern void php3_module_shutdown_for_exec(void);
|
||||
|
||||
#ifndef THREAD_SAFE
|
||||
extern unsigned char header_is_being_sent;
|
||||
extern int initialized;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -250,7 +250,6 @@ PHP_INI_END()
|
||||
*/
|
||||
int initialized; /* keep track of which resources were successfully initialized */
|
||||
static int module_initialized = 0;
|
||||
unsigned char header_is_being_sent;
|
||||
|
||||
#if WIN32|WINNT
|
||||
unsigned int wintimer;
|
||||
@@ -648,7 +647,7 @@ int php3_request_startup(CLS_D ELS_DC PLS_DC)
|
||||
|
||||
/* initialize global variables */
|
||||
{
|
||||
GLOBAL(header_is_being_sent) = 0;
|
||||
PG(header_is_being_sent)=0;
|
||||
}
|
||||
|
||||
if (php3_init_request_info(NULL)) {
|
||||
|
||||
@@ -63,7 +63,9 @@ struct _php_core_globals {
|
||||
long track_vars;
|
||||
|
||||
long y2k_compliance;
|
||||
|
||||
unsigned char header_is_being_sent;
|
||||
};
|
||||
|
||||
|
||||
#endif /* _PHP_GLOBALS_H */
|
||||
#endif /* _PHP_GLOBALS_H */
|
||||
|
||||
Reference in New Issue
Block a user