File tree Expand file tree Collapse file tree 4 files changed +48
-2
lines changed Expand file tree Collapse file tree 4 files changed +48
-2
lines changed Original file line number Diff line number Diff line change @@ -851,6 +851,15 @@ SAPI_API char *sapi_getenv(char *name, size_t name_len TSRMLS_DC)
851
851
}
852
852
}
853
853
854
+ SAPI_API int sapi_get_fd (int * fd TSRMLS_DC )
855
+ {
856
+ if (sapi_module .get_fd ) {
857
+ return sapi_module .get_fd (fd TSRMLS_CC );
858
+ } else {
859
+ return -1 ;
860
+ }
861
+ }
862
+
854
863
/*
855
864
* Local variables:
856
865
* tab-width: 4
Original file line number Diff line number Diff line change @@ -186,6 +186,8 @@ SAPI_API void sapi_get_default_content_type_header(sapi_header_struct *default_h
186
186
SAPI_API size_t sapi_apply_default_charset (char * * mimetype , size_t len TSRMLS_DC );
187
187
SAPI_API void sapi_activate_headers_only (TSRMLS_D );
188
188
189
+ SAPI_API int sapi_get_fd (int * fd TSRMLS_DC );
190
+
189
191
struct _sapi_module_struct {
190
192
char * name ;
191
193
char * pretty_name ;
@@ -217,12 +219,16 @@ struct _sapi_module_struct {
217
219
218
220
void (* block_interruptions )(void );
219
221
void (* unblock_interruptions )(void );
222
+
220
223
221
224
void (* default_post_reader )(TSRMLS_D );
222
225
void (* treat_data )(int arg , char * str , zval * destArray TSRMLS_DC );
223
226
char * executable_location ;
224
227
225
228
int php_ini_ignore ;
229
+
230
+ int (* get_fd )(int * fd TSRMLS_DC );
231
+
226
232
};
227
233
228
234
Original file line number Diff line number Diff line change @@ -343,6 +343,23 @@ static char *php_apache_getenv(char *name, size_t name_len TSRMLS_DC)
343
343
}
344
344
/* }}} */
345
345
346
+ /* {{{ sapi_apache_get_fd
347
+ */
348
+ static int sapi_apache_get_fd (int * nfd TSRMLS_DC )
349
+ {
350
+ request_rec * r = SG (server_context );
351
+ int fd ;
352
+
353
+ fd = r -> connection -> client -> fd ;
354
+
355
+ if (fd >= 0 ) {
356
+ if (nfd ) * nfd = fd ;
357
+ return 0 ;
358
+ }
359
+ return -1 ;
360
+ }
361
+ /* }}} */
362
+
346
363
/* {{{ sapi_module_struct apache_sapi_module
347
364
*/
348
365
static sapi_module_struct apache_sapi_module = {
@@ -382,7 +399,11 @@ static sapi_module_struct apache_sapi_module = {
382
399
unblock_alarms , /* Unblock interruptions */
383
400
#endif
384
401
385
- STANDARD_SAPI_MODULE_PROPERTIES
402
+ NULL , /* default post reader */
403
+ NULL , /* treat data */
404
+ NULL , /* exe location */
405
+ 0 , /* ini ignore */
406
+ sapi_apache_get_fd
386
407
};
387
408
/* }}} */
388
409
Original file line number Diff line number Diff line change @@ -382,6 +382,12 @@ static int php_thttpd_startup(sapi_module_struct *sapi_module)
382
382
return SUCCESS ;
383
383
}
384
384
385
+ static int sapi_thttpd_get_fd (int * nfd TSRMLS_DC )
386
+ {
387
+ if (nfd ) * nfd = TG (hc )-> conn_fd ;
388
+ return 0 ;
389
+ }
390
+
385
391
static sapi_module_struct thttpd_sapi_module = {
386
392
"thttpd" ,
387
393
"thttpd" ,
@@ -411,7 +417,11 @@ static sapi_module_struct thttpd_sapi_module = {
411
417
NULL , /* Block interruptions */
412
418
NULL , /* Unblock interruptions */
413
419
414
- STANDARD_SAPI_MODULE_PROPERTIES
420
+ NULL ,
421
+ NULL ,
422
+ NULL ,
423
+ 0 ,
424
+ sapi_thttpd_get_fd
415
425
};
416
426
417
427
static void thttpd_module_main (int show_source TSRMLS_DC )
You can’t perform that action at this time.
0 commit comments