mirror of
https://github.com/php/php-src.git
synced 2025-01-18 17:54:05 +08:00
Fix my session updates.
trans_sid handling will no longer slow down performance unless a session is actually in use.
This commit is contained in:
parent
5d451c9885
commit
d697a558ac
@ -83,6 +83,7 @@ php_ps_globals ps_globals;
|
||||
static ps_module *_php_find_ps_module(char *name TSRMLS_DC);
|
||||
static const ps_serializer *_php_find_ps_serializer(char *name TSRMLS_DC);
|
||||
|
||||
|
||||
static int session_adapt_uris(const char *src, size_t srclen, char **new, size_t *newlen, zend_bool do_flush TSRMLS_DC)
|
||||
{
|
||||
if (PS(define_sid) && (PS(session_status) == php_session_active)) {
|
||||
@ -94,6 +95,7 @@ static int session_adapt_uris(const char *src, size_t srclen, char **new, size_t
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void php_session_output_handler(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode TSRMLS_DC)
|
||||
{
|
||||
zend_bool do_flush;
|
||||
@ -107,19 +109,26 @@ static void php_session_output_handler(char *output, uint output_len, char **han
|
||||
}
|
||||
|
||||
|
||||
static void php_session_start_output_handler(INIT_FUNC_ARGS, uint chunk_size)
|
||||
static void php_session_start_output_handler(uint chunk_size TSRMLS_DC)
|
||||
{
|
||||
PHP_RINIT(url_scanner)(INIT_FUNC_ARGS_PASSTHRU);
|
||||
PHP_RINIT(url_scanner_ex)(INIT_FUNC_ARGS_PASSTHRU);
|
||||
php_url_scanner_activate(TSRMLS_C);
|
||||
php_url_scanner_ex_activate(TSRMLS_C);
|
||||
php_start_ob_buffer(NULL, chunk_size TSRMLS_CC);
|
||||
php_ob_set_internal_handler(php_session_output_handler, chunk_size TSRMLS_CC);
|
||||
}
|
||||
|
||||
|
||||
static void php_session_activate(TSRMLS_D)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void php_session_end_output_handler(SHUTDOWN_FUNC_ARGS)
|
||||
{
|
||||
PHP_RSHUTDOWN(url_scanner_ex)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
|
||||
PHP_RSHUTDOWN(url_scanner)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
|
||||
php_url_scanner_ex_deactivate(TSRMLS_C);
|
||||
php_url_scanner_deactivate(TSRMLS_C);
|
||||
}
|
||||
|
||||
|
||||
@ -924,6 +933,9 @@ static void php_session_start(TSRMLS_D)
|
||||
PS(define_sid) = define_sid;
|
||||
|
||||
PS(session_status) = php_session_active;
|
||||
if (!send_cookie && PS(use_trans_sid)) {
|
||||
php_session_start_output_handler(4096 TSRMLS_CC);
|
||||
}
|
||||
|
||||
php_session_cache_limiter(TSRMLS_C);
|
||||
php_session_initialize(TSRMLS_C);
|
||||
@ -1394,10 +1406,6 @@ PHP_RINIT_FUNCTION(session)
|
||||
php_session_start(TSRMLS_C);
|
||||
}
|
||||
|
||||
if (PS(use_trans_sid)) {
|
||||
php_session_start_output_handler(INIT_FUNC_ARGS_PASSTHRU, 4096);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -32,14 +32,14 @@
|
||||
#define BUFSIZE 256
|
||||
#endif
|
||||
|
||||
PHP_RINIT_FUNCTION(url_scanner)
|
||||
int php_url_scanner_activate(TSRMLS_D)
|
||||
{
|
||||
url_adapt(NULL,0,NULL,NULL);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
PHP_RSHUTDOWN_FUNCTION(url_scanner)
|
||||
int php_url_scanner_deactivate(TSRMLS_D)
|
||||
{
|
||||
url_adapt(NULL,0,NULL,NULL);
|
||||
return SUCCESS;
|
||||
|
@ -20,8 +20,8 @@
|
||||
#ifndef URI_SCANNER_H
|
||||
#define URI_SCANNER_H
|
||||
|
||||
PHP_RINIT_FUNCTION(url_scanner);
|
||||
PHP_RSHUTDOWN_FUNCTION(url_scanner);
|
||||
int php_url_scanner_activate(TSRMLS_D);
|
||||
int php_url_scanner_deactivate(TSRMLS_D);
|
||||
|
||||
char *url_adapt(const char *src, size_t srclen, const char *data, size_t *newlen);
|
||||
|
||||
|
@ -860,7 +860,7 @@ char *url_adapt_ext(const char *src, size_t srclen, const char *name, const char
|
||||
return ctx->result.c;
|
||||
}
|
||||
|
||||
PHP_RINIT_FUNCTION(url_scanner)
|
||||
int php_url_scanner_ex_activate(TSRMLS_D)
|
||||
{
|
||||
url_adapt_state_ex_t *ctx;
|
||||
|
||||
@ -871,7 +871,7 @@ PHP_RINIT_FUNCTION(url_scanner)
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
PHP_RSHUTDOWN_FUNCTION(url_scanner)
|
||||
int php_url_scanner_ex_deactivate(TSRMLS_D)
|
||||
{
|
||||
url_adapt_state_ex_t *ctx;
|
||||
|
||||
|
@ -21,8 +21,8 @@
|
||||
|
||||
PHP_MINIT_FUNCTION(url_scanner_ex);
|
||||
PHP_MSHUTDOWN_FUNCTION(url_scanner_ex);
|
||||
PHP_RSHUTDOWN_FUNCTION(url_scanner_ex);
|
||||
PHP_RINIT_FUNCTION(url_scanner_ex);
|
||||
int php_url_scanner_ex_activate(TSRMLS_D);
|
||||
int php_url_scanner_ex_deactivate(TSRMLS_D);
|
||||
|
||||
char *url_adapt_ext_ex(const char *src, size_t srclen, const char *name, const char *value, size_t *newlen, zend_bool do_flush TSRMLS_DC);
|
||||
|
||||
|
@ -376,7 +376,7 @@ char *url_adapt_ext(const char *src, size_t srclen, const char *name, const char
|
||||
return ctx->result.c;
|
||||
}
|
||||
|
||||
PHP_RINIT_FUNCTION(url_scanner)
|
||||
int php_url_scanner_ex_activate(TSRMLS_D)
|
||||
{
|
||||
url_adapt_state_ex_t *ctx;
|
||||
|
||||
@ -387,7 +387,7 @@ PHP_RINIT_FUNCTION(url_scanner)
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
PHP_RSHUTDOWN_FUNCTION(url_scanner)
|
||||
int php_url_scanner_ex_deactivate(TSRMLS_D)
|
||||
{
|
||||
url_adapt_state_ex_t *ctx;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user