本文整理汇总了C++中php_handle_aborted_connection函数的典型用法代码示例。如果您正苦于以下问题:C++ php_handle_aborted_connection函数的具体用法?C++ php_handle_aborted_connection怎么用?C++ php_handle_aborted_connection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了php_handle_aborted_connection函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: php_roxen_low_ub_write
static int
php_roxen_low_ub_write(const char *str, uint str_length TSRMLS_DC) {
int sent_bytes = 0;
struct pike_string *to_write = NULL;
#ifdef ROXEN_USE_ZTS
GET_THIS();
#endif
if(!MY_FD_OBJ->prog) {
PG(connection_status) = PHP_CONNECTION_ABORTED;
zend_bailout();
return -1;
}
to_write = make_shared_binary_string(str, str_length);
push_string(to_write);
safe_apply(MY_FD_OBJ, "write", 1);
if(Pike_sp[-1].type == PIKE_T_INT)
sent_bytes = Pike_sp[-1].u.integer;
pop_stack();
if(sent_bytes != str_length) {
/* This means the connection is closed. Dead. Gone. *sniff* */
php_handle_aborted_connection();
}
return sent_bytes;
}
示例2: sapi_thttpd_ub_write
static int sapi_thttpd_ub_write(const char *str, uint str_length TSRMLS_DC)
{
int n;
uint sent = 0;
if (TG(sbuf).c != 0) {
smart_str_appendl_ex(&TG(sbuf), str, str_length, 1);
return str_length;
}
while (str_length > 0) {
PHP_SYS_CALL(n = send(TG(hc)->conn_fd, str, str_length, 0););
if (n == -1) {
if (errno == EAGAIN) {
smart_str_appendl_ex(&TG(sbuf), str, str_length, 1);
return sent + str_length;
} else
php_handle_aborted_connection();
}
TG(hc)->bytes_sent += n;
str += n;
sent += n;
str_length -= n;
}
示例3: php_apache_sapi_ub_write
static int
php_apache_sapi_ub_write(const char *str, uint str_length TSRMLS_DC)
{
apr_bucket *b;
apr_bucket_brigade *bb;
apr_bucket_alloc_t *ba;
ap_filter_t *f; /* remaining output filters */
php_struct *ctx;
ctx = SG(server_context);
f = ctx->f;
if (str_length == 0) return 0;
ba = f->c->bucket_alloc;
bb = apr_brigade_create(ctx->r->pool, ba);
b = apr_bucket_transient_create(str, str_length, ba);
APR_BRIGADE_INSERT_TAIL(bb, b);
if (ap_pass_brigade(f->next, bb) != APR_SUCCESS || ctx->r->connection->aborted) {
php_handle_aborted_connection();
}
return str_length; /* we always consume all the data passed to us. */
}
示例4: sapi_cli_ub_write
static size_t sapi_cli_ub_write(const char *str, size_t str_length) /* {{{ */
{
const char *ptr = str;
size_t remaining = str_length;
size_t ret;
if (!str_length) {
return 0;
}
if (cli_shell_callbacks.cli_shell_ub_write) {
size_t ub_wrote;
ub_wrote = cli_shell_callbacks.cli_shell_ub_write(str, str_length);
if (ub_wrote != (size_t) -1) {
return ub_wrote;
}
}
while (remaining > 0)
{
ret = sapi_cli_single_write(ptr, remaining);
if (!ret) {
#ifndef PHP_CLI_WIN32_NO_CONSOLE
php_handle_aborted_connection();
#endif
break;
}
ptr += ret;
remaining -= ret;
}
return (ptr - str);
}
示例5: sapi_lsapi_flush
/* {{{ sapi_lsapi_flush
*/
static void sapi_lsapi_flush( void * server_context )
{
if ( lsapi_mode ) {
if ( LSAPI_Flush() == -1) {
php_handle_aborted_connection();
}
}
}
示例6: sapi_tux_ub_write
static int sapi_tux_ub_write(const char *str, uint str_length TSRMLS_DC)
{
int n;
int m;
const char *estr;
/* combine headers and body */
if (TG(number_vec)) {
struct iovec *vec = TG(header_vec);
n = TG(number_vec);
vec[n].iov_base = (void *) str;
vec[n++].iov_len = str_length;
/* XXX: this might need more complete error handling */
if ((m = writev(TG(req)->sock, vec, n)) == -1 && errno == EPIPE)
php_handle_aborted_connection();
if (m > 0)
TG(req)->bytes_sent += str_length;
TG(number_vec) = 0;
return str_length;
}
estr = str + str_length;
while (str < estr) {
n = send(TG(req)->sock, str, estr - str, 0);
if (n == -1 && errno == EPIPE)
php_handle_aborted_connection();
if (n == -1 && errno == EAGAIN)
continue;
if (n <= 0)
return n;
str += n;
}
n = str_length - (estr - str);
TG(req)->bytes_sent += n;
return n;
}
示例7: engine_ub_write
static int engine_ub_write(const char *str, uint str_length TSRMLS_DC) {
engine_context *context = (engine_context *) SG(server_context);
int written = context->write(context, str, str_length);
if (written != str_length) {
php_handle_aborted_connection();
}
return written;
}
示例8: sapi_uwsgi_ub_write
static int sapi_uwsgi_ub_write(const char *str, uint str_length TSRMLS_DC)
{
struct wsgi_request *wsgi_req = (struct wsgi_request *) SG(server_context);
wsgi_req->response_size += wsgi_req->socket->proto_write(wsgi_req, (char *) str, str_length);
if (wsgi_req->write_errors > uwsgi.write_errors_tolerance) {
php_handle_aborted_connection();
return -1;
}
return str_length;
}
示例9: sapi_cli_flush
static void sapi_cli_flush(void *server_context) /* {{{ */
{
/* Ignore EBADF here, it's caused by the fact that STDIN/STDOUT/STDERR streams
* are/could be closed before fflush() is called.
*/
if (fflush(stdout)==EOF && errno!=EBADF) {
#ifndef PHP_CLI_WIN32_NO_CONSOLE
php_handle_aborted_connection();
#endif
}
}
示例10: sapi_isapi_ub_write
static int sapi_isapi_ub_write(const char *str, uint str_length TSRMLS_DC)
{
DWORD num_bytes = str_length;
LPEXTENSION_CONTROL_BLOCK ecb;
ecb = (LPEXTENSION_CONTROL_BLOCK) SG(server_context);
if (ecb->WriteClient(ecb->ConnID, (char *) str, &num_bytes, HSE_IO_SYNC) == FALSE) {
php_handle_aborted_connection();
}
return num_bytes;
}
示例11: sapi_capi_ub_write
/*
* sapi_capi_ub_write: Write len bytes to the connection output.
*/
static int sapi_capi_ub_write(const char *str, unsigned int str_length TSRMLS_DC)
{
int retval;
capi_request_context *rc;
rc = (capi_request_context *) SG(server_context);
retval = httpFwrite(rc->t, (char *) str, str_length);
if (retval == -1 || retval == 0)
php_handle_aborted_connection();
return retval;
}
示例12: sapi_uwsgi_ub_write
static int sapi_uwsgi_ub_write(const char *str, uint str_length TSRMLS_DC)
#endif
{
struct wsgi_request *wsgi_req = (struct wsgi_request *) SG(server_context);
uwsgi_response_write_body_do(wsgi_req, (char *) str, str_length);
if (wsgi_req->write_errors > uwsgi.write_errors_tolerance) {
php_handle_aborted_connection();
return -1;
}
return str_length;
}
示例13: sapi_apache_ub_write
/* {{{ sapi_apache_ub_write
*/
static int sapi_apache_ub_write(const char *str, uint str_length TSRMLS_DC)
{
int ret=0;
if (SG(server_context)) {
ret = rwrite(str, str_length, (request_rec *) SG(server_context));
}
if (ret != str_length) {
php_handle_aborted_connection();
}
return ret;
}
示例14: php_phttpd_sapi_ub_write
static int
php_phttpd_sapi_ub_write(const char *str, uint str_length TSRMLS_DC)
{
int sent_bytes;
sent_bytes = fd_write(PHG(cip)->fd, str, str_length);
if (sent_bytes == -1) {
php_handle_aborted_connection();
}
return sent_bytes;
}
示例15: zend_pi3web_ub_write
static int zend_pi3web_ub_write(const char *str, uint str_length TSRMLS_DC)
{
DWORD num_bytes = str_length;
LPCONTROL_BLOCK cb;
cb = (LPCONTROL_BLOCK) SG(server_context);
if ( !IWasLoaded ) return 0;
cb->WriteClient(cb->ConnID, (char *) str, &num_bytes, 0 );
if (num_bytes != str_length)
php_handle_aborted_connection();
return num_bytes;
}