@@ -165,6 +165,7 @@ static PHP_METHOD(swoole_http_response, cookie);
165
165
static PHP_METHOD (swoole_http_response, rawcookie);
166
166
static PHP_METHOD (swoole_http_response, header);
167
167
static PHP_METHOD (swoole_http_response, initHeader);
168
+ static PHP_METHOD (swoole_http_response, isWritable);
168
169
static PHP_METHOD (swoole_http_response, detach);
169
170
static PHP_METHOD (swoole_http_response, create);
170
171
/* *
@@ -251,6 +252,7 @@ ZEND_END_ARG_INFO()
251
252
const zend_function_entry swoole_http_response_methods[] =
252
253
{
253
254
PHP_ME (swoole_http_response, initHeader, arginfo_swoole_http_void, ZEND_ACC_PUBLIC)
255
+ PHP_ME (swoole_http_response, isWritable, arginfo_swoole_http_void, ZEND_ACC_PUBLIC)
254
256
PHP_ME (swoole_http_response, cookie, arginfo_swoole_http_response_cookie, ZEND_ACC_PUBLIC)
255
257
PHP_MALIAS (swoole_http_response, setCookie, cookie, arginfo_swoole_http_response_cookie, ZEND_ACC_PUBLIC)
256
258
PHP_ME (swoole_http_response, rawcookie, arginfo_swoole_http_response_cookie, ZEND_ACC_PUBLIC)
@@ -701,6 +703,14 @@ static PHP_METHOD(swoole_http_response, initHeader) {
701
703
RETURN_TRUE;
702
704
}
703
705
706
+ static PHP_METHOD (swoole_http_response, isWritable) {
707
+ http_context *ctx = php_swoole_http_response_get_context (ZEND_THIS);
708
+ if (!ctx || (ctx->end || ctx->detached )) {
709
+ RETURN_FALSE;
710
+ }
711
+ RETURN_TRUE;
712
+ }
713
+
704
714
static PHP_METHOD (swoole_http_response, end) {
705
715
http_context *ctx = php_swoole_http_response_get_and_check_context (ZEND_THIS);
706
716
if (UNEXPECTED (!ctx)) {
0 commit comments