Newer
Older
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
* @param r current request record of client request
* @param brigade The brigade that is sent through the output filter chain
*/
PROXY_DECLARE(void) ap_proxy_backend_broke(request_rec *r,
apr_bucket_brigade *brigade);
/**
* Return a hash based on the passed string
* @param str string to produce hash from
* @param method hashing method to use
* @return hash as unsigned int
*/
typedef enum { PROXY_HASHFUNC_DEFAULT, PROXY_HASHFUNC_APR, PROXY_HASHFUNC_FNV } proxy_hash_t;
PROXY_DECLARE(unsigned int) ap_proxy_hashfunc(const char *str, proxy_hash_t method);
/**
* Set/unset the worker status bitfield depending on flag
* @param c flag
* @param set set or unset bit
* @param w worker to use
* @return APR_SUCCESS if valid flag
*/
PROXY_DECLARE(apr_status_t) ap_proxy_set_wstatus(char c, int set, proxy_worker *w);
/**
* Create readable representation of worker status bitfield
* @param p pool
* @param w worker to use
* @return string representation of status
*/
PROXY_DECLARE(char *) ap_proxy_parse_wstatus(apr_pool_t *p, proxy_worker *w);
/**
* Sync balancer and workers based on any updates w/i shm
* @param b balancer to check/update member list of
* @param s server rec
* @param conf config
* @return APR_SUCCESS if all goes well
*/
PROXY_DECLARE(apr_status_t) ap_proxy_sync_balancer(proxy_balancer *b,
server_rec *s,
proxy_server_conf *conf);
/**
* Find the matched alias for this request and setup for proxy handler
* @param r request
* @param ent proxy_alias record
* @param dconf per-dir config or NULL
* @return DECLINED, DONE or OK if matched
*/
PROXY_DECLARE(int) ap_proxy_trans_match(request_rec *r,
struct proxy_alias *ent,
proxy_dir_conf *dconf);
/**
* Create a HTTP request header brigade, old_cl_val and old_te_val as required.
* @param p pool
* @param header_brigade header brigade to use/fill
* @param r request
* @param p_conn proxy connection rec
* @param worker selected worker
* @param conf per-server proxy config
* @param uri uri
* @param url url
* @param server_portstr port as string
* @param old_cl_val stored old content-len val
* @param old_te_val stored old TE val
* @return OK or HTTP_EXPECTATION_FAILED
*/
PROXY_DECLARE(int) ap_proxy_create_hdrbrgd(apr_pool_t *p,
apr_bucket_brigade *header_brigade,
request_rec *r,
proxy_conn_rec *p_conn,
proxy_worker *worker,
proxy_server_conf *conf,
apr_uri_t *uri,
char *url, char *server_portstr,
char **old_cl_val,
char **old_te_val);
/**
* @param bucket_alloc bucket allocator
* @param r request
* @param p_conn proxy connection
* @param origin connection rec of origin
* @param bb brigade to send to origin
* @param flush flush
* @return status (OK)
*/
PROXY_DECLARE(int) ap_proxy_pass_brigade(apr_bucket_alloc_t *bucket_alloc,
request_rec *r, proxy_conn_rec *p_conn,
conn_rec *origin, apr_bucket_brigade *bb,
int flush);
/**
* Clear the headers referenced by the Connection header from the given
* table, and remove the Connection header.
* @param r request
* @param headers table of headers to clear
* @return 1 if "close" was present, 0 otherwise.
*/
APR_DECLARE_OPTIONAL_FN(int, ap_proxy_clear_connection,
(request_rec *r, apr_table_t *headers));
/**
* @param socket socket to test
* @return TRUE if socket is connected/active
*/
PROXY_DECLARE(int) ap_proxy_is_socket_connected(apr_socket_t *socket);
#define PROXY_LBMETHOD "proxylbmethod"
/* The number of dynamic workers that can be added when reconfiguring.
* If this limit is reached you must stop and restart the server.
*/
#define PROXY_DYNAMIC_BALANCER_LIMIT 16
/**
* Calculate maximum number of workers in scoreboard.
* @return number of workers to allocate in the scoreboard
*/
int ap_proxy_lb_workers(void);
/**
* Return the port number of a known scheme (eg: http -> 80).
* @param scheme scheme to test
* @return port number or 0 if unknown
*/
PROXY_DECLARE(apr_port_t) ap_proxy_port_of_scheme(const char *scheme);
/**
* Return the name of the health check method (eg: "OPTIONS").
* @param method method enum
* @return name of method
*/
PROXY_DECLARE (const char *) ap_proxy_show_hcmethod(hcmethod_t method);
/**
* Strip a unix domain socket (UDS) prefix from the input URL
* @param p pool to allocate result from
* @param url a URL potentially prefixed with a UDS path
* @return URL with the UDS prefix removed
*/
PROXY_DECLARE(const char *) ap_proxy_de_socketfy(apr_pool_t *p, const char *url);
/*
* Transform buckets from one bucket allocator to another one by creating a
* transient bucket for each data bucket and let it use the data read from
* the old bucket. Metabuckets are transformed by just recreating them.
* Attention: Currently only the following bucket types are handled:
*
* All data buckets
* FLUSH
* EOS
*
* If an other bucket type is found its type is logged as a debug message
* and APR_EGENERAL is returned.
*
* @param r request_rec of the actual request. Used for logging purposes
* @param from the bucket brigade to take the buckets from
* @param to the bucket brigade to store the transformed buckets
* @return apr_status_t of the operation. Either APR_SUCCESS or
* APR_EGENERAL
*/
PROXY_DECLARE(apr_status_t) ap_proxy_buckets_lifetime_transform(request_rec *r,
apr_bucket_brigade *from,
apr_bucket_brigade *to);
/*
* Sends all data that can be read non blocking from the input filter chain of
* c_i and send it down the output filter chain of c_o. For reading it uses
* the bucket brigade bb_i which should be created from the bucket allocator
* associated with c_i. For sending through the output filter chain it uses
* the bucket brigade bb_o which should be created from the bucket allocator
* associated with c_o. In order to get the buckets from bb_i to bb_o
* ap_proxy_buckets_lifetime_transform is used.
*
* @param r request_rec of the actual request. Used for logging purposes
* @param c_i inbound connection conn_rec
* @param c_o outbound connection conn_rec
* @param bb_i bucket brigade for pulling data from the inbound connection
* @param bb_o bucket brigade for sending data through the outbound connection
* @param name string for logging from where data was pulled
* @param sent if not NULL will be set to 1 if data was sent through c_o
* @param bsize maximum amount of data pulled in one iteration from c_i
* @param after if set flush data on c_o only once after the loop
* @return apr_status_t of the operation. Could be any error returned from
* either the input filter chain of c_i or the output filter chain
* of c_o. APR_EPIPE if the outgoing connection was aborted.
*/
PROXY_DECLARE(apr_status_t) ap_proxy_transfer_between_connections(
request_rec *r,
conn_rec *c_i,
conn_rec *c_o,
apr_bucket_brigade *bb_i,
apr_bucket_brigade *bb_o,
const char *name,
int *sent,
apr_off_t bsize,
int after);
extern module PROXY_DECLARE_DATA proxy_module;
#endif /*MOD_PROXY_H*/
/** @} */