*/
typedef apr_status_t (*ap_out_filter_func)(ap_filter_t *f, apr_bucket_brigade *b);
typedef apr_status_t (*ap_in_filter_func)(ap_filter_t *f, apr_bucket_brigade *b,
- ap_input_mode_t mode, apr_size_t readbytes);
+ ap_input_mode_t mode, apr_size_t *readbytes);
typedef union ap_filter_func {
ap_out_filter_func out_func;
* a single line should be read.
*/
AP_DECLARE(apr_status_t) ap_get_brigade(ap_filter_t *filter, apr_bucket_brigade *bucket,
- ap_input_mode_t mode, apr_size_t readbytes);
+ ap_input_mode_t mode, apr_size_t *readbytes);
/**
* Pass the current bucket brigade down to the next filter on the filter
static apr_status_t CaseFilterInFilter(ap_filter_t *f,
apr_bucket_brigade *pbbOut,
- ap_input_mode_t eMode,apr_size_t nBytes)
+ ap_input_mode_t eMode,apr_size_t *nBytes)
{
CaseFilterInContext *pCtx=f->ctx;
apr_status_t ret;
}
static int xlate_in_filter(ap_filter_t *f, apr_bucket_brigade *bb,
- ap_input_mode_t mode, apr_size_t readbytes)
+ ap_input_mode_t mode, apr_size_t *readbytes)
{
apr_status_t rv;
charset_req_t *reqinfo = ap_get_module_config(f->r->request_config,
#if 0
static int ef_input_filter(ap_filter_t *f, apr_bucket_brigade *bb,
- ap_input_mode_t mode, apr_size_t readbytes)
+ ap_input_mode_t mode, apr_size_t *readbytes)
{
apr_status_t rv;
apr_bucket *b;
static long get_chunk_size(char *);
apr_status_t ap_dechunk_filter(ap_filter_t *f, apr_bucket_brigade *bb,
- ap_input_mode_t mode, apr_size_t readbytes)
+ ap_input_mode_t mode, apr_size_t *readbytes)
{
apr_status_t rv;
struct dechunk_ctx *ctx = f->ctx;
apr_size_t chunk_bytes = ctx->chunk_size - ctx->bytes_delivered;
if ((rv = ap_get_brigade(f->next, bb, mode,
- chunk_bytes)) != APR_SUCCESS) {
+ &chunk_bytes)) != APR_SUCCESS) {
return rv;
}
apr_bucket_brigade *b;
} http_ctx_t;
-apr_status_t ap_http_filter(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode, apr_size_t readbytes)
+apr_status_t ap_http_filter(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode, apr_size_t *readbytes)
{
apr_bucket *e;
char *buff;
}
/* readbytes == 0 is "read a single line". otherwise, read a block. */
- if (readbytes) {
+ if (*readbytes) {
/* ### the code below, which moves bytes from one brigade to the
### other is probably bogus. presuming the next filter down was
* a time - don't assume that one call to apr_bucket_read()
* will return the full string.
*/
- if (readbytes < len) {
- apr_bucket_split(e, readbytes);
- readbytes = 0;
+ if (*readbytes < len) {
+ apr_bucket_split(e, *readbytes);
+ *readbytes = 0;
}
else {
- readbytes -= len;
+ *readbytes -= len;
}
APR_BUCKET_REMOVE(e);
APR_BRIGADE_INSERT_TAIL(b, e);
### chunks to determine where the end of the request is, so we
### shouldn't be monkeying with EOS buckets.
*/
- if (readbytes == 0) {
+ if (*readbytes == 0) {
apr_bucket *eos = apr_bucket_eos_create();
APR_BRIGADE_INSERT_TAIL(b, eos);
do {
if (APR_BRIGADE_EMPTY(bb)) {
if (ap_get_brigade(r->input_filters, bb, AP_MODE_BLOCKING,
- r->remaining) != APR_SUCCESS) {
+ &r->remaining) != APR_SUCCESS) {
/* if we actually fail here, we want to just return and
* stop trying to read data from the client.
*/
* these
*/
r->read_length += len_read; /* XXX yank me? */
- r->remaining -= len_read; /* XXX yank me? */
old = b;
b = APR_BUCKET_NEXT(b);
apr_bucket_delete(old);
### allow us to defer creation of the brigade to when we actually
### need to send a FLUSH. */
apr_bucket_brigade *bb = apr_brigade_create(r->pool);
+ int zero = 0;
/* Flush the filter contents if:
*
/* ### shouldn't this read from the connection input filters? */
/* ### is zero correct? that means "read one line" */
if (!r->connection->keepalive ||
- ap_get_brigade(r->input_filters, bb, AP_MODE_PEEK, 0) != APR_SUCCESS) {
+ ap_get_brigade(r->input_filters, bb, AP_MODE_PEEK, &zero) != APR_SUCCESS) {
apr_bucket *e = apr_bucket_flush_create();
/* We just send directly to the connection based filters. At
* These (input) filters are internal to the mod_core operation.
*/
apr_status_t ap_http_filter(ap_filter_t *f, apr_bucket_brigade *b,
- ap_input_mode_t mode, apr_size_t readbytes);
+ ap_input_mode_t mode, apr_size_t *readbytes);
apr_status_t ap_dechunk_filter(ap_filter_t *f, apr_bucket_brigade *b,
- ap_input_mode_t mode, apr_size_t readbytes);
+ ap_input_mode_t mode, apr_size_t *readbytes);
char *ap_response_code_string(request_rec *r, int error_index);
found = ap_pregsub(r->pool, p->real, r->uri,
p->regexp->re_nsub + 1, regm);
if (found && doesc) {
- found = ap_escape_uri(r->pool, found);
+ uri_components uri;
+ ap_parse_uri_components(r->pool, found, &uri);
+ found = ap_escape_uri(r->pool, uri.path);
+ if (uri.query) {
+ found = apr_pstrcat(r->pool, found, "?", uri.query, NULL);
+ }
+ else if (uri.fragment) {
+ found = apr_pstrcat(r->pool, found, "#", uri.fragment, NULL);
+
+ }
}
}
else {
return APR_SUCCESS;
}
-static apr_status_t churn(TLSFilterCtx *pCtx,apr_read_type_e eReadType,apr_size_t readbytes)
+static apr_status_t churn(TLSFilterCtx *pCtx,apr_read_type_e eReadType,apr_size_t *readbytes)
{
ap_input_mode_t eMode=eReadType == APR_BLOCK_READ ? AP_MODE_BLOCKING
: AP_MODE_NONBLOCKING;
}
static apr_status_t tls_in_filter(ap_filter_t *f,apr_bucket_brigade *pbbOut,
- ap_input_mode_t eMode, apr_size_t readbytes)
+ ap_input_mode_t eMode, apr_size_t *readbytes)
{
TLSFilterCtx *pCtx=f->ctx;
apr_read_type_e eReadType=eMode == AP_MODE_BLOCKING ? APR_BLOCK_READ :
return ap_pass_brigade(r->output_filters, bb);
}
-static int core_input_filter(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode, apr_size_t readbytes)
+static int core_input_filter(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode, apr_size_t *readbytes)
{
apr_bucket *e;
- /* ### we should obey readbytes. the policy is to not insert more than
- ### READBYTES into the brigade. the caller knows the amount that is
- ### proper for the protocol. reading more than that could cause
- ### problems.
- ### (of course, we can read them from the socket, we just should not
- ### return them until asked)
- */
-
if (!f->ctx) { /* If we haven't passed up the socket yet... */
f->ctx = (void *)1;
e = apr_bucket_socket_create(f->c->client_socket);
&mpm_perchild_module);
char *foo;
apr_size_t len;
+ int zero = 0;
apr_pool_userdata_get((void **)&foo, "PERCHILD_BUFFER", r->connection->pool);
len = strlen(foo);
### reading large chunks of data or something?
*/
while (ap_get_brigade(r->input_filters, bb, AP_MODE_NONBLOCKING,
- 0 /* read one line */) == APR_SUCCESS) {
+ &zero /* read one line */) == APR_SUCCESS) {
apr_bucket *e;
APR_BRIGADE_FOREACH(e, bb) {
const char *str;
return OK;
}
-static apr_status_t perchild_buffer(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode, apr_size_t readbytes)
+static apr_status_t perchild_buffer(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode, apr_size_t *readbytes)
{
apr_bucket *e;
apr_status_t rv;
&mpm_perchild_module);
char *foo;
apr_size_t len;
+ int zero = 0;
apr_pool_userdata_get((void **)&foo, "PERCHILD_BUFFER", r->connection->pool);
len = strlen(foo);
### reading large chunks of data or something?
*/
while (ap_get_brigade(r->input_filters, bb, AP_MODE_NONBLOCKING,
- 0 /* read one line */) == APR_SUCCESS) {
+ &zero /* read one line */) == APR_SUCCESS) {
apr_bucket *e;
APR_BRIGADE_FOREACH(e, bb) {
const char *str;
return OK;
}
-static apr_status_t perchild_buffer(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode, apr_size_t readbytes)
+static apr_status_t perchild_buffer(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode, apr_size_t *readbytes)
{
apr_bucket *e;
apr_status_t rv;
while (1) {
if (APR_BRIGADE_EMPTY(b)) {
+ int zero = 0;
if ((retval = ap_get_brigade(c->input_filters, b,
AP_MODE_BLOCKING,
- 0 /* readline */)) != APR_SUCCESS ||
+ &zero /* readline */)) != APR_SUCCESS ||
APR_BRIGADE_EMPTY(b)) {
apr_brigade_destroy(b);
return -1;
AP_DECLARE(apr_status_t) ap_get_brigade(ap_filter_t *next,
apr_bucket_brigade *bb,
ap_input_mode_t mode,
- apr_size_t readbytes)
+ apr_size_t *readbytes)
{
if (next) {
return next->frec->filter_func.in_func(next, bb, mode, readbytes);