static PHP_HTTP_FILTER_DESTRUCTOR(chunked_decode) { PHP_HTTP_FILTER_BUFFER(chunked_decode) *b = Z_PTR(this->abstract); php_http_buffer_dtor(PHP_HTTP_BUFFER(b)); pefree(b, this->is_persistent); }
void php_http_message_parser_object_free(zend_object *object) { php_http_message_parser_object_t *o = PHP_HTTP_OBJ(object, NULL); if (o->parser) { php_http_message_parser_free(&o->parser); } php_http_buffer_dtor(&o->buffer); zend_object_std_dtor(object); }
static PHP_HTTP_FILTER_FUNCTION(chunked_encode) { php_http_buffer_t buf; php_stream_bucket *ptr, *nxt; if (bytes_consumed) { *bytes_consumed = 0; } /* new data available? */ php_http_buffer_init(&buf); /* fetch available bucket data */ for (ptr = buckets_in->head; ptr; ptr = nxt) { if (bytes_consumed) { *bytes_consumed += ptr->buflen; } #if DBG_FILTER fprintf(stderr, "update: chunked (-> %zu) (w: %zu, r: %zu)\n", ptr->buflen, stream->writepos, stream->readpos); #endif nxt = ptr->next; php_stream_bucket_unlink(ptr); php_http_buffer_appendf(&buf, "%lx" PHP_HTTP_CRLF, (long unsigned int) ptr->buflen); php_http_buffer_append(&buf, ptr->buf, ptr->buflen); php_http_buffer_appends(&buf, PHP_HTTP_CRLF); /* pass through */ NEW_BUCKET(buf.data, buf.used); /* reset */ php_http_buffer_reset(&buf); php_stream_bucket_delref(ptr); } /* free buffer */ php_http_buffer_dtor(&buf); /* terminate with "0" */ if (PHP_HTTP_FILTER_IS_CLOSING(stream, flags)) { #if DBG_FILTER fprintf(stderr, "finish: chunked\n"); #endif NEW_BUCKET("0" PHP_HTTP_CRLF PHP_HTTP_CRLF, lenof("0" PHP_HTTP_CRLF PHP_HTTP_CRLF)); } return PSFS_PASS_ON; }