summaryrefslogtreecommitdiff
path: root/output.c
diff options
context:
space:
mode:
authorSascha Schumann <sas@php.net>1999-09-11 23:47:16 +0000
committerSascha Schumann <sas@php.net>1999-09-11 23:47:16 +0000
commitf040ce584d1509d61e96fa503b611e14685e71db (patch)
tree30408a76ba71e54c1ad66c90c495bb93b5321335 /output.c
parent9706aa1daa3008c1352cd53023355041136a0da5 (diff)
downloadphp-git-f040ce584d1509d61e96fa503b611e14685e71db.tar.gz
add transparent session id propagation
this uses a custom scanner which detects relative URIs and changes them appropiately. must be explicitly enabled with --enable-trans-sid (normal case is not affected, since session_adapt_uris defaults to void statement. Compiler should eliminate dead code in output.c then.)
Diffstat (limited to 'output.c')
-rw-r--r--output.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/output.c b/output.c
index 7a3037c0cf..3739d41d9e 100644
--- a/output.c
+++ b/output.c
@@ -20,6 +20,7 @@
#include "php.h"
#include "ext/standard/head.h"
+#include "ext/session/php_session.h"
#include "SAPI.h"
/* output functions */
@@ -189,17 +190,31 @@ static int zend_ub_body_write_no_header(const char *str, uint str_length)
static int zend_ub_body_write(const char *str, uint str_length)
{
+ char *newstr = NULL;
+ uint new_length;
+ int result = 0;
SLS_FETCH();
if (SG(request_info).headers_only) {
zend_bailout();
}
if (php3_header()) {
+ session_adapt_uris(str, str_length, &newstr, &new_length);
+
+ if (newstr) {
+ str = newstr;
+ str_length = new_length;
+ }
+
zend_body_write = zend_ub_body_write_no_header;
- return zend_header_write(str, str_length);
- } else {
- return 0;
+ result = zend_header_write(str, str_length);
+
+ if (newstr) {
+ free(newstr);
+ }
}
+
+ return result;
}