Apache HTTPD
eor_bucket.c
Go to the documentation of this file.
1/* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "httpd.h"
18#include "http_request.h"
19#include "http_protocol.h"
20#include "scoreboard.h"
21
26
28{
30
31 if (*rp) {
32 request_rec *r = *rp;
33 /*
34 * If eor_bucket_destroy is called after us, this prevents
35 * eor_bucket_destroy from trying to destroy the pool again.
36 */
37 *rp = NULL;
38 /* Update child status and log the transaction */
43 }
44 }
45 return APR_SUCCESS;
46}
47
50{
51 *str = NULL;
52 *len = 0;
53 return APR_SUCCESS;
54}
55
57{
59
60 h = apr_bucket_alloc(sizeof(*h), b->list);
61 h->data = r;
62
63 b = apr_bucket_shared_make(b, h, 0, 0);
64 b->type = &ap_bucket_type_eor;
65 return b;
66}
67
70{
71 apr_bucket *b = apr_bucket_alloc(sizeof(*b), list);
72
74 b->free = apr_bucket_free;
75 b->list = list;
77 if (r) {
78 ap_bucket_eor *h = b->data;
79 /*
80 * Register a cleanup for the request pool as the eor bucket could
81 * have been allocated from a different pool then the request pool
82 * e.g. the parent pool of the request pool. In this case
83 * eor_bucket_destroy might be called at a point of time when the
84 * request pool had been already destroyed.
85 * We need to use a pre-cleanup here because a module may create a
86 * sub-pool which is still needed during the log_transaction hook.
87 */
89 }
90 return b;
91}
92
93static void eor_bucket_destroy(void *data)
94{
96
98 request_rec *r = h->data;
99 if (r) {
100 /* eor_bucket_cleanup will be called when the pool gets destroyed */
102 }
104 }
105}
106
115
#define AP_DECLARE_DATA
Definition ap_config.h:89
#define AP_DECLARE(type)
Definition ap_config.h:67
const char apr_size_t len
Definition ap_regex.h:187
static apr_status_t eor_bucket_cleanup(void *data)
Definition eor_bucket.c:27
static apr_status_t eor_bucket_read(apr_bucket *b, const char **str, apr_size_t *len, apr_read_type_e block)
Definition eor_bucket.c:48
static void eor_bucket_destroy(void *data)
Definition eor_bucket.c:93
request_rec * r
int ap_run_log_transaction(request_rec *r)
Definition protocol.c:2587
const apr_bucket_type_t ap_bucket_type_eor
Definition eor_bucket.c:107
apr_bucket * ap_bucket_eor_create(apr_bucket_alloc_t *list, request_rec *r)
Definition eor_bucket.c:68
apr_bucket * ap_bucket_eor_make(apr_bucket *b, request_rec *r)
Definition eor_bucket.c:56
#define APR_BUCKET_INIT(e)
apr_read_type_e
Definition apr_buckets.h:57
apr_size_t size
const apr_array_header_t * list
Definition apr_cstr.h:105
#define APR_SUCCESS
Definition apr_errno.h:225
int apr_status_t
Definition apr_errno.h:44
void * data
const apr_hash_t * h
Definition apr_hash.h:97
apr_pool_t * b
Definition apr_pools.h:529
HTTP protocol handling.
Apache Request library.
HTTP Daemon routines.
return NULL
Definition mod_so.c:359
Apache scoreboard library.
#define SERVER_BUSY_LOG
Definition scoreboard.h:62
int ap_extended_status
Definition scoreboard.c:61
int ap_update_child_status(ap_sb_handle_t *sbh, int status, request_rec *r)
Definition scoreboard.c:590
void ap_increment_counts(ap_sb_handle_t *sbh, request_rec *r)
Definition scoreboard.c:379
request_rec * data
Definition eor_bucket.c:24
apr_bucket_refcount refcount
Definition eor_bucket.c:23
void * sbh
Definition httpd.h:1199
A structure that represents the current request.
Definition httpd.h:845
apr_pool_t * pool
Definition httpd.h:847
conn_rec * connection
Definition httpd.h:849
#define str