]> granicus.if.org Git - apache/blob - modules/http2/h2_task.h
rework of output handling on stream/session close, rework of cleartext (http:) output...
[apache] / modules / http2 / h2_task.h
1 /* Copyright 2015 greenbytes GmbH (https://www.greenbytes.de)
2  *
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
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  
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.
14  */
15
16 #ifndef __mod_h2__h2_task__
17 #define __mod_h2__h2_task__
18
19 /**
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.
22  *
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().
28  *
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.
32  *
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.
36  */
37
38 struct apr_thread_cond_t;
39 struct h2_conn;
40 struct h2_mplx;
41 struct h2_task;
42 struct h2_resp_head;
43 struct h2_worker;
44
45 typedef struct h2_task h2_task;
46
47 struct h2_task {
48     const char *id;
49     int stream_id;
50     struct h2_mplx *mplx;
51     
52     const char *method;
53     const char *scheme;
54     const char *authority;
55     const char *path;
56     apr_table_t *headers;
57     int input_eos;
58
59     int serialize_headers;
60
61     struct conn_rec *c;
62
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;
67     
68     struct apr_thread_cond_t *io;   /* used to wait for events on */
69 };
70
71 h2_task *h2_task_create(long session_id, int stream_id, 
72                         apr_pool_t *pool, struct h2_mplx *mplx,
73                         conn_rec *c);
74
75 apr_status_t h2_task_destroy(h2_task *task);
76
77 void h2_task_set_request(h2_task *task, 
78                          const char *method, 
79                          const char *scheme, 
80                          const char *authority, 
81                          const char *path, 
82                          apr_table_t *headers, int eos);
83
84
85 apr_status_t h2_task_do(h2_task *task, struct h2_worker *worker);
86
87 void h2_task_register_hooks(void);
88
89 #endif /* defined(__mod_h2__h2_task__) */