1 /* Copyright 2015 greenbytes GmbH (https://www.greenbytes.de)
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #ifndef __mod_h2__h2_task__
17 #define __mod_h2__h2_task__
20 * A h2_task fakes a HTTP/1.1 request from the data in a HTTP/2 stream
21 * (HEADER+CONT.+DATA) the module recieves.
23 * In order to answer a HTTP/2 stream, we want all Apache httpd infrastructure
24 * to be involved as usual, as if this stream can as a separate HTTP/1.1
25 * request. The basic trickery to do so was derived from google's mod_spdy
26 * source. Basically, we fake a new conn_rec object, even with its own
27 * socket and give it to ap_process_connection().
29 * Since h2_task instances are executed in separate threads, we may have
30 * different lifetimes than our h2_stream or h2_session instances. Basically,
31 * we would like to be as standalone as possible.
33 * Finally, to keep certain connection level filters, such as ourselves and
34 * especially mod_ssl ones, from messing with our data, we need a filter
35 * of our own to disble those.
38 struct apr_thread_cond_t;
45 typedef struct h2_task h2_task;
54 const char *authority;
59 int serialize_headers;
63 apr_pool_t *pool; /* pool for task lifetime things */
64 apr_bucket_alloc_t *bucket_alloc;
65 struct h2_task_input *input;
66 struct h2_task_output *output;
68 struct apr_thread_cond_t *io; /* used to wait for events on */
71 h2_task *h2_task_create(long session_id, int stream_id,
72 apr_pool_t *pool, struct h2_mplx *mplx,
75 apr_status_t h2_task_destroy(h2_task *task);
77 void h2_task_set_request(h2_task *task,
80 const char *authority,
82 apr_table_t *headers, int eos);
85 apr_status_t h2_task_do(h2_task *task, struct h2_worker *worker);
87 void h2_task_register_hooks(void);
89 #endif /* defined(__mod_h2__h2_task__) */