summaryrefslogtreecommitdiff
path: root/sapi
diff options
context:
space:
mode:
authorSascha Schumann <sas@php.net>2000-11-13 13:23:56 +0000
committerSascha Schumann <sas@php.net>2000-11-13 13:23:56 +0000
commit3fbfbf1f45cd2b6c37e7419e25a1aee6b8d793c5 (patch)
treec3940925b521f69dd315c7a4f9dd980d50d19ee5 /sapi
parent04f180b08acbfd2d176685a160b8d678780af428 (diff)
downloadphp-git-3fbfbf1f45cd2b6c37e7419e25a1aee6b8d793c5.tar.gz
Add thttpd-dependent interface for maintaining persistent connections on
an iterative web-server. This will be used by the IRCG extension.
Diffstat (limited to 'sapi')
-rw-r--r--sapi/thttpd/php_thttpd.h5
-rw-r--r--sapi/thttpd/thttpd.c21
2 files changed, 26 insertions, 0 deletions
diff --git a/sapi/thttpd/php_thttpd.h b/sapi/thttpd/php_thttpd.h
index e2e070330f..699ac5d83d 100644
--- a/sapi/thttpd/php_thttpd.h
+++ b/sapi/thttpd/php_thttpd.h
@@ -27,4 +27,9 @@ void thttpd_php_shutdown(void);
void thttpd_php_init(void);
off_t thttpd_php_request(httpd_conn *hc);
+void thttpd_register_on_close(void (*)(int));
+void thttpd_closed_conn(int fd);
+int thttpd_get_fd(void);
+void thttpd_set_dont_close(void);
+
#endif
diff --git a/sapi/thttpd/thttpd.c b/sapi/thttpd/thttpd.c
index 37104565a9..1d1467bd44 100644
--- a/sapi/thttpd/thttpd.c
+++ b/sapi/thttpd/thttpd.c
@@ -27,6 +27,7 @@
typedef struct {
httpd_conn *hc;
int post_off;
+ void (*on_close)(int);
} php_thttpd_globals;
static php_thttpd_globals thttpd_globals;
@@ -283,6 +284,26 @@ off_t thttpd_php_request(httpd_conn *hc)
return 0;
}
+void thttpd_register_on_close(void (*arg)(int))
+{
+ TG(on_close) = arg;
+}
+
+void thttpd_closed_conn(int fd)
+{
+ if (TG(on_close)) TG(on_close)(fd);
+}
+
+int thttpd_get_fd(void)
+{
+ return TG(hc)->conn_fd;
+}
+
+void thttpd_set_dont_close(void)
+{
+ TG(hc)->file_address = (char *) 1;
+}
+
void thttpd_php_init(void)
{
sapi_startup(&sapi_module);