blob: 4d1581b48b15b356ae523322a19f97a304ab5b26 [file] [log] [blame]
Christopher Faulet78fbb9f2019-08-11 23:11:03 +02001/*
2 * include/types/fcgi-app.h
3 * This file defines everything related to FCGI applications.
4 *
5 * Copyright (C) 2019 HAProxy Technologies, Christopher Faulet <cfaulet@haproxy.com>
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation, version 2.1
10 * exclusively.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#ifndef _TYPES_HTTP_FCGI_H
23#define _TYPES_HTTP_FCGI_H
24
Willy Tarreaudcc048a2020-06-04 19:11:43 +020025#include <haproxy/acl-t.h>
Willy Tarreau4c7e4b72020-05-27 12:58:42 +020026#include <haproxy/api-t.h>
Willy Tarreaueb6f7012020-05-27 16:21:26 +020027#include <import/ist.h>
Willy Tarreaufa2ef5b2020-06-03 14:56:08 +020028#include <haproxy/fcgi.h>
Willy Tarreauc7babd82020-06-04 21:29:29 +020029#include <haproxy/filters-t.h>
Willy Tarreau853b2972020-05-27 18:01:47 +020030#include <haproxy/list-t.h>
Willy Tarreau7cd8b6e2020-06-02 17:32:26 +020031#include <haproxy/regex-t.h>
Christopher Faulet78fbb9f2019-08-11 23:11:03 +020032
Willy Tarreau8d2b7772020-05-27 10:58:19 +020033#include <import/ebistree.h>
Christopher Faulet78fbb9f2019-08-11 23:11:03 +020034
Christopher Faulet78fbb9f2019-08-11 23:11:03 +020035#define FCGI_APP_FL_KEEP_CONN 0x00000001 /* Keep the connection alive */
36#define FCGI_APP_FL_GET_VALUES 0x00000002 /* Retrieve FCGI variables on connection establishment */
37#define FCGI_APP_FL_MPXS_CONNS 0x00000004 /* FCGI APP supports connection multiplexing */
38
39
40enum fcgi_rule_type {
41 FCGI_RULE_SET_PARAM = 0,
42 FCGI_RULE_UNSET_PARAM,
43 FCGI_RULE_PASS_HDR,
44 FCGI_RULE_HIDE_HDR,
45};
46
47/* Used during configuration parsing only and converted into fcgi_rule when
48 * filter is created.
49 */
50struct fcgi_rule_conf {
51 enum fcgi_rule_type type;
52 char *name;
53 char *value;
54 struct acl_cond *cond; /* acl condition to set/unset the param */
55 struct list list;
56};
57
58/* parameter rule evaluated during request analyzis */
59struct fcgi_rule {
60 enum fcgi_rule_type type;
61 struct ist name; /* name of the parameter/header */
62 struct list value; /* log-format compatible expression, may be empty */
63 struct acl_cond *cond; /* acl condition to set the param */
64 struct list list;
65};
66
67/* parameter rule to set/unset a param at the end of the analyzis */
68struct fcgi_param_rule {
69 struct ist name;
70 struct list *value; /* if empty , unset the parameter */
71 struct ebpt_node node;
72};
73
74/* header rule to pass/hide a header at the end of the analyzis */
75struct fcgi_hdr_rule {
76 struct ist name;
77 int pass; /* 1 to pass the header, 0 Otherwise */
78 struct ebpt_node node;
79};
80
81struct fcgi_app {
82 char *name; /* name to identify this set of params */
83 struct ist docroot; /* FCGI docroot */
84 struct ist index; /* filename to append to URI ending by a '/' */
85 struct my_regex *pathinfo_re; /* Regex to use to split scriptname and path-info */
86 unsigned int flags; /* FCGI_APP_FL_* */
87 struct list logsrvs; /* log servers */
88 unsigned int maxreqs; /* maximum number of concurrent requests */
89
90 struct list acls; /* list of acls declared for this application */
91
92 struct {
93 char *file; /* file where the section appears */
94 int line; /* line where the section appears */
95 struct list rules; /* list of rules used during config parsing */
96 struct arg_list args; /* sample arg list that need to be resolved */
97 } conf; /* config information */
98 struct fcgi_app *next; /* used to chain fcgi-app */
99};
100
101/* FCGI config attached to backend proxies */
102struct fcgi_flt_conf {
103 char *name; /* fcgi-app name used during config parsing */
104 struct fcgi_app *app; /* configuration of the fcgi application */
105
106 struct list param_rules; /* list of set/unset rules */
107 struct list hdr_rules; /* list of pass/add rules */
108};
109
110/* FCGI context attached to streames */
111struct fcgi_flt_ctx {
112 struct filter *filter;
113 struct fcgi_app *app;
114};
115
116#endif /* _TYPES_HTTP_FCGI_H */
117
118/*
119 * Local variables:
120 * c-indent-level: 8
121 * c-basic-offset: 8
122 * End:
123 */