I would have prefered you to leave STANDARD_SAPI_MODULE_PROPERTIES. Why didn't you put fd earlier? I don't think BC is much of an issue here. Or am I missing something?

Andi

At 05:15 AM 11/26/2002 +0000, Sascha Schumann wrote:
sas Tue Nov 26 00:15:55 2002 EDT

Modified files:
/php4/main SAPI.c SAPI.h
/php4/sapi/apache mod_php4.c
/php4/sapi/thttpd thttpd.c
Log:
Add sapi_get_fd() and implement it for the Apache/thttpd SAPIs.


Index: php4/main/SAPI.c
diff -u php4/main/SAPI.c:1.157 php4/main/SAPI.c:1.158
--- php4/main/SAPI.c:1.157 Thu Nov 21 05:29:11 2002
+++ php4/main/SAPI.c Tue Nov 26 00:15:55 2002
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/

-/* $Id: SAPI.c,v 1.157 2002/11/21 10:29:11 hholzgra Exp $ */
+/* $Id: SAPI.c,v 1.158 2002/11/26 05:15:55 sas Exp $ */

#include <ctype.h>
#include <sys/stat.h>
@@ -848,6 +848,15 @@
return sapi_module.getenv(name, name_len TSRMLS_CC);
} else {
return NULL;
+ }
+}
+
+SAPI_API int sapi_get_fd(int *fd TSRMLS_DC)
+{
+ if (sapi_module.get_fd) {
+ return sapi_module.get_fd(fd TSRMLS_CC);
+ } else {
+ return -1;
}
}

Index: php4/main/SAPI.h
diff -u php4/main/SAPI.h:1.89 php4/main/SAPI.h:1.90
--- php4/main/SAPI.h:1.89 Mon Nov 18 01:04:06 2002
+++ php4/main/SAPI.h Tue Nov 26 00:15:55 2002
@@ -186,6 +186,8 @@
SAPI_API size_t sapi_apply_default_charset(char **mimetype, size_t len TSRMLS_DC);
SAPI_API void sapi_activate_headers_only(TSRMLS_D);

+SAPI_API int sapi_get_fd(int *fd TSRMLS_DC);
+
struct _sapi_module_struct {
char *name;
char *pretty_name;
@@ -217,12 +219,16 @@

void (*block_interruptions)(void);
void (*unblock_interruptions)(void);
+

void (*default_post_reader)(TSRMLS_D);
void (*treat_data)(int arg, char *str, zval *destArray TSRMLS_DC);
char *executable_location;

int php_ini_ignore;
+
+ int (*get_fd)(int *fd TSRMLS_DC);
+
};


Index: php4/sapi/apache/mod_php4.c
diff -u php4/sapi/apache/mod_php4.c:1.146 php4/sapi/apache/mod_php4.c:1.147
--- php4/sapi/apache/mod_php4.c:1.146 Sun Nov 10 14:34:09 2002
+++ php4/sapi/apache/mod_php4.c Tue Nov 26 00:15:55 2002
@@ -17,7 +17,7 @@
| PHP 4.0 patches by Zeev Suraski <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: mod_php4.c,v 1.146 2002/11/10 19:34:09 iliaa Exp $ */
+/* $Id: mod_php4.c,v 1.147 2002/11/26 05:15:55 sas Exp $ */

#include "php_apache_http.h"

@@ -343,6 +343,23 @@
}
/* }}} */

+/* {{{ sapi_apache_get_fd
+ */
+static int sapi_apache_get_fd(int *nfd TSRMLS_DC)
+{
+ request_rec *r = SG(server_context);
+ int fd;
+
+ fd = r->connection->client->fd;
+
+ if (fd >= 0) {
+ if (nfd) *nfd = fd;
+ return 0;
+ }
+ return -1;
+}
+/* }}} */
+
/* {{{ sapi_module_struct apache_sapi_module
*/
static sapi_module_struct apache_sapi_module = {
@@ -382,7 +399,11 @@
unblock_alarms, /* Unblock interruptions */
#endif

- STANDARD_SAPI_MODULE_PROPERTIES
+ NULL, /* default post reader */
+ NULL, /* treat data */
+ NULL, /* exe location */
+ 0, /* ini ignore */
+ sapi_apache_get_fd
};
/* }}} */

Index: php4/sapi/thttpd/thttpd.c
diff -u php4/sapi/thttpd/thttpd.c:1.77 php4/sapi/thttpd/thttpd.c:1.78
--- php4/sapi/thttpd/thttpd.c:1.77 Fri Nov 8 08:29:32 2002
+++ php4/sapi/thttpd/thttpd.c Tue Nov 26 00:15:55 2002
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/

-/* $Id: thttpd.c,v 1.77 2002/11/08 13:29:32 sas Exp $ */
+/* $Id: thttpd.c,v 1.78 2002/11/26 05:15:55 sas Exp $ */

#include "php.h"
#include "SAPI.h"
@@ -382,6 +382,12 @@
return SUCCESS;
}

+static int sapi_thttpd_get_fd(int *nfd TSRMLS_DC)
+{
+ if (nfd) *nfd = TG(hc)->conn_fd;
+ return 0;
+}
+
static sapi_module_struct thttpd_sapi_module = {
"thttpd",
"thttpd",
@@ -411,7 +417,11 @@
NULL, /* Block interruptions */
NULL, /* Unblock interruptions */

- STANDARD_SAPI_MODULE_PROPERTIES
+ NULL,
+ NULL,
+ NULL,
+ 0,
+ sapi_thttpd_get_fd
};

static void thttpd_module_main(int show_source TSRMLS_DC)



--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to