Skip to content

Commit

Permalink
Merge pull request #2664 from cuchac/php_disconnect
Browse files Browse the repository at this point in the history
PHP: Add support for uwsgi.disconnect() function
  • Loading branch information
xrmx authored Sep 8, 2024
2 parents f41c7c3 + c1fdce1 commit 7bdd6da
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions plugins/php/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@

#include "ext/session/php_session.h"

#include "ext/standard/head.h"

#include <uwsgi.h>

16 changes: 16 additions & 0 deletions plugins/php/php_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,21 @@ PHP_FUNCTION(uwsgi_signal) {
RETURN_NULL();
}

PHP_FUNCTION(uwsgi_disconnect) {

struct wsgi_request *wsgi_req = (struct wsgi_request *) SG(server_context);

php_output_end_all();
php_header();

uwsgi_disconnect(wsgi_req);

php_output_set_status(PHP_OUTPUT_DISABLED);

RETURN_NULL();
}


ZEND_BEGIN_ARG_INFO_EX(arginfo_void, 0, 0, 0)
ZEND_END_ARG_INFO()

Expand All @@ -517,6 +532,7 @@ zend_function_entry uwsgi_php_functions[] = {
PHP_FE(uwsgi_cache_del, arginfo_void)
PHP_FE(uwsgi_cache_clear, arginfo_void)
PHP_FE(uwsgi_cache_exists, arginfo_void)
PHP_FE(uwsgi_disconnect, arginfo_void)
{ NULL, NULL, NULL},
};

Expand Down

0 comments on commit 7bdd6da

Please sign in to comment.