Apache HTTPD
h2_bucket_eos.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 <assert.h>
18#include <stddef.h>
19
20#include <httpd.h>
21#include <http_core.h>
22#include <http_connection.h>
23#include <http_log.h>
24#include <http_protocol.h>
25
26#include "h2_private.h"
27#include "h2.h"
28#include "h2_mplx.h"
29#include "h2_stream.h"
30#include "h2_bucket_eos.h"
31
36
38{
40
41 if (*pstream) {
42 /* If bucket_destroy is called after us, this prevents
43 * bucket_destroy from trying to destroy the stream again. */
44 *pstream = NULL;
45 }
46 return APR_SUCCESS;
47}
48
49static apr_status_t bucket_read(apr_bucket *b, const char **str,
51{
52 (void)b;
53 (void)block;
54 *str = NULL;
55 *len = 0;
56 return APR_SUCCESS;
57}
58
60{
62
63 h = apr_bucket_alloc(sizeof(*h), b->list);
64 h->stream = stream;
65
66 b = apr_bucket_shared_make(b, h, 0, 0);
67 b->type = &h2_bucket_type_eos;
68
69 return b;
70}
71
73 h2_stream *stream)
74{
75 apr_bucket *b = apr_bucket_alloc(sizeof(*b), list);
76
78 b->free = apr_bucket_free;
79 b->list = list;
80 b = h2_bucket_eos_make(b, stream);
81 if (stream) {
82 h2_bucket_eos *h = b->data;
84 }
85 return b;
86}
87
88static void bucket_destroy(void *data)
89{
91
93 h2_stream *stream = h->stream;
94 if (stream && stream->pool) {
95 apr_pool_cleanup_kill(stream->pool, &h->stream, bucket_cleanup);
96 }
98 if (stream) {
100 }
101 }
102}
103
112
const char apr_size_t len
Definition ap_regex.h:187
#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
@ H2_SEV_EOS_SENT
Definition h2.h:157
static void bucket_destroy(void *data)
apr_bucket * h2_bucket_eos_create(apr_bucket_alloc_t *list, h2_stream *stream)
static apr_status_t bucket_cleanup(void *data)
static apr_status_t bucket_read(apr_bucket *b, const char **str, apr_size_t *len, apr_read_type_e block)
apr_bucket * h2_bucket_eos_make(apr_bucket *b, h2_stream *stream)
const apr_bucket_type_t h2_bucket_type_eos
void h2_stream_dispatch(h2_stream *stream, h2_stream_event_t ev)
Definition h2_stream.c:392
Apache connection library.
CORE HTTP Daemon.
Apache Logging library.
HTTP protocol handling.
HTTP Daemon routines.
return NULL
Definition mod_so.c:359
h2_stream * stream
apr_bucket_refcount refcount
apr_pool_t * pool
Definition h2_stream.h:84
#define str