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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 * @brief Proxy Extension Module for Apache
24 * @defgroup MOD_PROXY mod_proxy
25 * @ingroup APACHE_MODS
31 Also note numerous FIXMEs and CHECKMEs which should be eliminated.
33 This code is once again experimental!
37 1. Make it completely work (for FTP too)
41 Chuck Murcko <chuck@topsail.org> 02-06-01
47 #include "apr_hooks.h"
50 #include "apr_strings.h"
51 #include "apr_buckets.h"
53 #include "apr_network_io.h"
54 #include "apr_pools.h"
55 #include "apr_strings.h"
58 #include "apr_strmatch.h"
59 #include "apr_fnmatch.h"
60 #include "apr_reslist.h"
61 #define APR_WANT_STRFUNC
65 #include "http_config.h"
66 #include "ap_config.h"
67 #include "http_core.h"
68 #include "http_protocol.h"
69 #include "http_request.h"
70 #include "http_vhost.h"
71 #include "http_main.h"
73 #include "http_connection.h"
74 #include "util_filter.h"
75 #include "util_ebcdic.h"
76 #include "ap_provider.h"
78 #if APR_HAVE_NETINET_IN_H
79 #include <netinet/in.h>
81 #if APR_HAVE_ARPA_INET_H
82 #include <arpa/inet.h>
85 /* for proxy_canonenc() */
87 enc_path, enc_search, enc_user, enc_fpath, enc_parm
90 #if APR_CHARSET_EBCDIC
92 #else /*APR_CHARSET_EBCDIC*/
93 #define CRLF "\015\012"
94 #endif /*APR_CHARSET_EBCDIC*/
96 /* default Max-Forwards header setting */
97 #define DEFAULT_MAX_FORWARDS 10
99 /* static information about a remote proxy */
100 struct proxy_remote {
101 const char *scheme; /* the schemes handled by this proxy, or '*' */
102 const char *protocol; /* the scheme used to talk to this proxy */
103 const char *hostname; /* the hostname of this proxy */
104 apr_port_t port; /* the port for this proxy */
105 ap_regex_t *regexp; /* compiled regex (if any) for the remote */
106 int use_regex; /* simple boolean. True if we have a regex pattern */
114 struct dirconn_entry {
116 struct in_addr addr, mask;
117 struct apr_sockaddr_t *hostaddr;
118 int (*matcher) (struct dirconn_entry * This, request_rec *r);
121 struct noproxy_entry {
123 struct apr_sockaddr_t *addr;
126 typedef struct proxy_balancer proxy_balancer;
127 typedef struct proxy_worker proxy_worker;
128 typedef struct proxy_conn_pool proxy_conn_pool;
129 typedef struct proxy_balancer_method proxy_balancer_method;
132 apr_array_header_t *proxies;
133 apr_array_header_t *sec_proxy;
134 apr_array_header_t *aliases;
135 apr_array_header_t *noproxies;
136 apr_array_header_t *dirconn;
137 apr_array_header_t *allowed_connect_ports;
138 apr_array_header_t *workers;
139 apr_array_header_t *balancers;
140 proxy_worker *forward; /* forward proxy worker */
141 proxy_worker *reverse; /* reverse "module-driven" proxy worker */
142 const char *domain; /* domain name to use in absence of a domain name in the request */
143 int req; /* true if proxy requests are enabled */
150 } viaopt; /* how to deal with proxy Via: headers */
152 apr_size_t recv_buffer_size;
153 char recv_buffer_size_set;
154 apr_size_t io_buffer_size;
155 char io_buffer_size_set;
159 * the following setting masks the error page
160 * returned from the 'proxied server' and just
161 * forwards the status code upwards.
162 * This allows the main server (us) to generate
163 * the error page, (so it will look like a error
164 * returned from the rest of the system
167 int error_override_set;
169 int preserve_host_set;
170 apr_interval_time_t timeout;
176 } badopt; /* how to deal with bad headers */
178 /* putting new stuff on the end maximises binary back-compatibility.
179 * the strmatch_patterns are really a const just to have a
180 * case-independent strstr.
186 } proxy_status; /* Status display options */
187 char proxy_status_set;
188 apr_pool_t *pool; /* Pool used for allocating this struct */
193 const char *p; /* The path */
194 int p_is_fnmatch; /* Is this path an fnmatch candidate? */
195 ap_regex_t *r; /* Is this a regex? */
197 /* ProxyPassReverse and friends are documented as working inside
198 * <Location>. But in fact they never have done in the case of
199 * more than one <Location>, because the server_conf can't see it.
200 * We need to move them to the per-dir config.
201 * Discussed in February:
202 * http://marc.theaimsgroup.com/?l=apache-httpd-dev&m=110726027118798&w=2
204 apr_array_header_t *raliases;
205 apr_array_header_t* cookie_paths;
206 apr_array_header_t* cookie_domains;
207 const apr_strmatch_pattern* cookie_path_str;
208 const apr_strmatch_pattern* cookie_domain_str;
212 conn_rec *connection;
213 const char *hostname;
216 apr_pool_t *pool; /* Subpool used for creating socket */
217 apr_socket_t *sock; /* Connection socket */
218 apr_sockaddr_t *addr; /* Preparsed remote address info */
219 apr_uint32_t flags; /* Conection flags */
220 int close; /* Close 'this' connection */
221 int close_on_recycle; /* Close the connection when returning to pool */
222 proxy_worker *worker; /* Connection pool this connection belogns to */
223 void *data; /* per scheme connection data */
225 int inreslist; /* connection in apr_reslist? */
230 float cache_completion; /* completion percentage */
231 int content_length; /* length of the content */
234 /* Connection pool */
235 struct proxy_conn_pool {
236 apr_pool_t *pool; /* The pool used in constructor and destructor calls */
237 apr_sockaddr_t *addr; /* Preparsed remote address info */
239 apr_reslist_t *res; /* Connection resource list */
241 proxy_conn_rec *conn; /* Single connection for prefork mpm's */
244 /* worker status flags */
245 #define PROXY_WORKER_INITIALIZED 0x0001
246 #define PROXY_WORKER_IGNORE_ERRORS 0x0002
247 #define PROXY_WORKER_IN_SHUTDOWN 0x0010
248 #define PROXY_WORKER_DISABLED 0x0020
249 #define PROXY_WORKER_STOPPED 0x0040
250 #define PROXY_WORKER_IN_ERROR 0x0080
251 #define PROXY_WORKER_HOT_STANDBY 0x0100
253 #define PROXY_WORKER_NOT_USABLE_BITMAP ( PROXY_WORKER_IN_SHUTDOWN | \
254 PROXY_WORKER_DISABLED | PROXY_WORKER_STOPPED | PROXY_WORKER_IN_ERROR )
256 #define PROXY_WORKER_IS_INITIALIZED(f) ( (f)->s->status & \
257 PROXY_WORKER_INITIALIZED )
259 #define PROXY_WORKER_IS_STANDBY(f) ( (f)->s->status & \
260 PROXY_WORKER_HOT_STANDBY )
262 #define PROXY_WORKER_IS_USABLE(f) ( !((f)->s->status & \
263 (PROXY_WORKER_NOT_USABLE_BITMAP)) && PROXY_WORKER_IS_INITIALIZED(f) )
265 /* default worker retry timeout in seconds */
266 #define PROXY_WORKER_DEFAULT_RETRY 60
267 #define PROXY_WORKER_MAX_ROUTE_SIZ 63
269 /* Runtime worker status informations. Shared in scoreboard */
272 apr_time_t error_time; /* time of the last error */
273 int retries; /* number of retries on this worker */
274 int lbstatus; /* Current lbstatus */
275 int lbfactor; /* dynamic lbfactor */
276 apr_off_t transferred;/* Number of bytes transferred to remote */
277 apr_off_t read; /* Number of bytes read from remote */
278 apr_size_t elected; /* Number of times the worker was elected */
279 char route[PROXY_WORKER_MAX_ROUTE_SIZ+1];
280 char redirect[PROXY_WORKER_MAX_ROUTE_SIZ+1];
281 void *context; /* general purpose storage */
284 /* Worker configuration */
285 struct proxy_worker {
286 int id; /* scoreboard id */
287 apr_interval_time_t retry; /* retry interval */
288 int lbfactor; /* initial load balancing factor */
290 const char *scheme; /* scheme to use ajp|http|https */
291 const char *hostname; /* remote backend address */
292 const char *route; /* balancing route */
293 const char *redirect; /* temporary balancing redirection route */
294 int status; /* temporary worker status */
296 int min; /* Desired minimum number of available connections */
297 int smax; /* Soft maximum on the total number of connections */
298 int hmax; /* Hard maximum on the total number of connections */
299 apr_interval_time_t ttl; /* maximum amount of time in seconds a connection
300 * may be available while exceeding the soft limit */
301 apr_interval_time_t timeout; /* connection timeout */
303 apr_interval_time_t acquire; /* acquire timeout when the maximum number of connections is exceeded */
305 apr_size_t recv_buffer_size;
306 char recv_buffer_size_set;
307 apr_size_t io_buffer_size;
308 char io_buffer_size_set;
311 proxy_conn_pool *cp; /* Connection pool to use */
312 proxy_worker_stat *s; /* Shared data */
313 void *opaque; /* per scheme worker data */
314 int is_address_reusable;
316 apr_thread_mutex_t *mutex; /* Thread lock for updating address cache */
318 void *context; /* general purpose storage */
323 } flush_packets; /* control AJP flushing */
324 int flush_wait; /* poll wait time in microseconds if flush_auto */
328 * Wait 10000 microseconds to find out if more data is currently
329 * available at the backend. Just an arbitrary choose.
331 #define PROXY_FLUSH_WAIT 10000
333 struct proxy_balancer {
334 apr_array_header_t *workers; /* array of proxy_workers */
335 const char *name; /* name of the load balancer */
336 const char *sticky; /* sticky session identifier */
337 int sticky_force; /* Disable failover for sticky sessions */
338 apr_interval_time_t timeout; /* Timeout for waiting on free connection */
339 int max_attempts; /* Number of attempts before failing */
340 char max_attempts_set;
341 proxy_balancer_method *lbmethod;
343 /* XXX: Perhaps we will need the proc mutex too.
344 * Altrough we are only using arithmetic operations
345 * it may lead to a incorrect calculations.
346 * For now use only the thread mutex.
349 apr_thread_mutex_t *mutex; /* Thread lock for updating lb params */
351 void *context; /* general purpose storage */
354 struct proxy_balancer_method {
355 const char *name; /* name of the load balancer method*/
356 proxy_worker *(*finder)(proxy_balancer *balancer,
358 void *context; /* general purpose storage */
362 #define PROXY_THREAD_LOCK(x) apr_thread_mutex_lock((x)->mutex)
363 #define PROXY_THREAD_UNLOCK(x) apr_thread_mutex_unlock((x)->mutex)
365 #define PROXY_THREAD_LOCK(x) APR_SUCCESS
366 #define PROXY_THREAD_UNLOCK(x) APR_SUCCESS
371 /* Create a set of PROXY_DECLARE(type), PROXY_DECLARE_NONSTD(type) and
372 * PROXY_DECLARE_DATA with appropriate export and import tags for the platform
375 #define PROXY_DECLARE(type) type
376 #define PROXY_DECLARE_NONSTD(type) type
377 #define PROXY_DECLARE_DATA
378 #elif defined(PROXY_DECLARE_STATIC)
379 #define PROXY_DECLARE(type) type __stdcall
380 #define PROXY_DECLARE_NONSTD(type) type
381 #define PROXY_DECLARE_DATA
382 #elif defined(PROXY_DECLARE_EXPORT)
383 #define PROXY_DECLARE(type) __declspec(dllexport) type __stdcall
384 #define PROXY_DECLARE_NONSTD(type) __declspec(dllexport) type
385 #define PROXY_DECLARE_DATA __declspec(dllexport)
387 #define PROXY_DECLARE(type) __declspec(dllimport) type __stdcall
388 #define PROXY_DECLARE_NONSTD(type) __declspec(dllimport) type
389 #define PROXY_DECLARE_DATA __declspec(dllimport)
393 * Hook an optional proxy hook. Unlike static hooks, this uses a macro
394 * instead of a function.
396 #define PROXY_OPTIONAL_HOOK(name,fn,pre,succ,order) \
397 APR_OPTIONAL_HOOK(proxy,name,fn,pre,succ,order)
399 APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, scheme_handler, (request_rec *r,
400 proxy_worker *worker, proxy_server_conf *conf, char *url,
401 const char *proxyhost, apr_port_t proxyport))
402 APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, canon_handler, (request_rec *r,
405 APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, create_req, (request_rec *r, request_rec *pr))
406 APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, fixups, (request_rec *r))
410 * It will return the most suitable worker at the moment
411 * and coresponding balancer.
412 * The url is rewritten from balancer://cluster/uri to scheme://host:port/uri
413 * and then the scheme_handler is called.
416 APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, pre_request, (proxy_worker **worker,
417 proxy_balancer **balancer,
419 proxy_server_conf *conf, char **url))
422 * It is called after request for updating runtime balancer status.
424 APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, post_request, (proxy_worker *worker,
425 proxy_balancer *balancer, request_rec *r,
426 proxy_server_conf *conf))
429 * request status hook
430 * It is called after all proxy processing has been done. This gives other
431 * modules a chance to create default content on failure, for example
433 APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, request_status,
434 (int *status, request_rec *r))
438 PROXY_DECLARE(request_rec *)ap_proxy_make_fake_req(conn_rec *c, request_rec *r);
439 PROXY_DECLARE(int) ap_proxy_hex2c(const char *x);
440 PROXY_DECLARE(void) ap_proxy_c2hex(int ch, char *x);
441 PROXY_DECLARE(char *)ap_proxy_canonenc(apr_pool_t *p, const char *x, int len, enum enctype t,
442 int forcedec, int proxyreq);
443 PROXY_DECLARE(char *)ap_proxy_canon_netloc(apr_pool_t *p, char **const urlp, char **userp,
444 char **passwordp, char **hostp, apr_port_t *port);
445 PROXY_DECLARE(const char *)ap_proxy_date_canon(apr_pool_t *p, const char *x);
446 PROXY_DECLARE(int) ap_proxy_liststr(const char *list, const char *val);
447 PROXY_DECLARE(char *)ap_proxy_removestr(apr_pool_t *pool, const char *list, const char *val);
448 PROXY_DECLARE(int) ap_proxy_hex2sec(const char *x);
449 PROXY_DECLARE(void) ap_proxy_sec2hex(int t, char *y);
450 PROXY_DECLARE(int) ap_proxyerror(request_rec *r, int statuscode, const char *message);
451 PROXY_DECLARE(int) ap_proxy_is_ipaddr(struct dirconn_entry *This, apr_pool_t *p);
452 PROXY_DECLARE(int) ap_proxy_is_domainname(struct dirconn_entry *This, apr_pool_t *p);
453 PROXY_DECLARE(int) ap_proxy_is_hostname(struct dirconn_entry *This, apr_pool_t *p);
454 PROXY_DECLARE(int) ap_proxy_is_word(struct dirconn_entry *This, apr_pool_t *p);
455 PROXY_DECLARE(int) ap_proxy_checkproxyblock(request_rec *r, proxy_server_conf *conf, apr_sockaddr_t *uri_addr);
456 PROXY_DECLARE(int) ap_proxy_pre_http_request(conn_rec *c, request_rec *r);
457 PROXY_DECLARE(apr_status_t) ap_proxy_string_read(conn_rec *c, apr_bucket_brigade *bb, char *buff, size_t bufflen, int *eos);
458 PROXY_DECLARE(void) ap_proxy_table_unmerge(apr_pool_t *p, apr_table_t *t, char *key);
459 /* DEPRECATED (will be replaced with ap_proxy_connect_backend */
460 PROXY_DECLARE(int) ap_proxy_connect_to_backend(apr_socket_t **, const char *, apr_sockaddr_t *, const char *, proxy_server_conf *, server_rec *, apr_pool_t *);
461 PROXY_DECLARE(int) ap_proxy_ssl_enable(conn_rec *c);
462 PROXY_DECLARE(int) ap_proxy_ssl_disable(conn_rec *c);
463 PROXY_DECLARE(int) ap_proxy_conn_is_https(conn_rec *c);
464 PROXY_DECLARE(const char *) ap_proxy_ssl_val(apr_pool_t *p, server_rec *s, conn_rec *c, request_rec *r, const char *var);
466 /* Header mapping functions, and a typedef of their signature */
467 PROXY_DECLARE(const char *) ap_proxy_location_reverse_map(request_rec *r, proxy_dir_conf *conf, const char *url);
468 PROXY_DECLARE(const char *) ap_proxy_cookie_reverse_map(request_rec *r, proxy_dir_conf *conf, const char *str);
471 typedef const char *(*ap_proxy_header_reverse_map_fn)(request_rec *,
472 proxy_dir_conf *, const char *);
473 #elif defined(PROXY_DECLARE_STATIC)
474 typedef const char *(__stdcall *ap_proxy_header_reverse_map_fn)(request_rec *,
475 proxy_dir_conf *, const char *);
476 #elif defined(PROXY_DECLARE_EXPORT)
477 typedef __declspec(dllexport) const char *
478 (__stdcall *ap_proxy_header_reverse_map_fn)(request_rec *,
479 proxy_dir_conf *, const char *);
481 typedef __declspec(dllimport) const char *
482 (__stdcall *ap_proxy_header_reverse_map_fn)(request_rec *,
483 proxy_dir_conf *, const char *);
487 /* Connection pool API */
489 * Get the worker from proxy configuration
490 * @param p memory pool used for finding worker
491 * @param conf current proxy server configuration
492 * @param url url to find the worker from
493 * @return proxy_worker or NULL if not found
495 PROXY_DECLARE(proxy_worker *) ap_proxy_get_worker(apr_pool_t *p,
496 proxy_server_conf *conf,
499 * Add the worker to proxy configuration
500 * @param worker the new worker
501 * @param p memory pool to allocate worker from
502 * @param conf current proxy server configuration
503 * @param url url containing worker name
504 * @return error message or NULL if successfull
506 PROXY_DECLARE(const char *) ap_proxy_add_worker(proxy_worker **worker,
508 proxy_server_conf *conf,
513 * @param p memory pool to allocate worker from
516 PROXY_DECLARE(proxy_worker *) ap_proxy_create_worker(apr_pool_t *p);
519 * Initize the worker's shared data
520 * @param conf current proxy server configuration
521 * @param worker worker to initialize
522 * @param s current server record
523 * @param worker worker to initialize
525 PROXY_DECLARE(void) ap_proxy_initialize_worker_share(proxy_server_conf *conf,
526 proxy_worker *worker,
532 * @param worker worker to initialize
533 * @param s current server record
534 * @return APR_SUCCESS or error code
536 PROXY_DECLARE(apr_status_t) ap_proxy_initialize_worker(proxy_worker *worker,
539 * Get the balancer from proxy configuration
540 * @param p memory pool used for finding balancer
541 * @param conf current proxy server configuration
542 * @param url url to find the worker from. Has to have balancer:// prefix
543 * @return proxy_balancer or NULL if not found
545 PROXY_DECLARE(proxy_balancer *) ap_proxy_get_balancer(apr_pool_t *p,
546 proxy_server_conf *conf,
549 * Add the balancer to proxy configuration
550 * @param balancer the new balancer
551 * @param p memory pool to allocate balancer from
552 * @param conf current proxy server configuration
553 * @param url url containing balancer name
554 * @return error message or NULL if successfull
556 PROXY_DECLARE(const char *) ap_proxy_add_balancer(proxy_balancer **balancer,
558 proxy_server_conf *conf,
562 * Add the worker to the balancer
563 * @param pool memory pool for adding worker
564 * @param balancer balancer to add to
565 * @param balancer worker to add
566 * @note Single worker can be added to multiple balancers.
568 PROXY_DECLARE(void) ap_proxy_add_worker_to_balancer(apr_pool_t *pool,
569 proxy_balancer *balancer,
570 proxy_worker *worker);
572 * Get the most suitable worker and(or) balancer for the request
573 * @param worker worker used for processing request
574 * @param balancer balancer used for processing request
575 * @param r current request
576 * @param conf current proxy server configuration
577 * @param url request url that balancer can rewrite.
578 * @return OK or HTTP_XXX error
579 * @note It calls balancer pre_request hook if the url starts with balancer://
580 * The balancer then rewrites the url to particular worker, like http://host:port
582 PROXY_DECLARE(int) ap_proxy_pre_request(proxy_worker **worker,
583 proxy_balancer **balancer,
585 proxy_server_conf *conf,
588 * Post request worker and balancer cleanup
589 * @param worker worker used for processing request
590 * @param balancer balancer used for processing request
591 * @param r current request
592 * @param conf current proxy server configuration
593 * @return OK or HTTP_XXX error
594 * @note When ever the pre_request is called, the post_request has to be
597 PROXY_DECLARE(int) ap_proxy_post_request(proxy_worker *worker,
598 proxy_balancer *balancer,
600 proxy_server_conf *conf);
603 * Request status function
604 * @param status status of proxy request
605 * @return OK or DECLINED
607 PROXY_DECLARE(int) ap_proxy_request_status(int *status, request_rec *r);
610 * Deternime backend hostname and port
611 * @param p memory pool used for processing
612 * @param r current request
613 * @param conf current proxy server configuration
614 * @param worker worker used for processing request
615 * @param conn proxy connection struct
616 * @param uri processed uri
617 * @param url request url
618 * @param proxyname are we connecting directly or via s proxy
619 * @param proxyport proxy host port
620 * @param server_portstr Via headers server port
621 * @param server_portstr_size size of the server_portstr buffer
622 * @return OK or HTTP_XXX error
624 PROXY_DECLARE(int) ap_proxy_determine_connection(apr_pool_t *p, request_rec *r,
625 proxy_server_conf *conf,
626 proxy_worker *worker,
627 proxy_conn_rec *conn,
630 const char *proxyname,
631 apr_port_t proxyport,
632 char *server_portstr,
633 int server_portstr_size);
635 * Mark a worker for retry
636 * @param proxy_function calling proxy scheme (http, ajp, ...)
637 * @param conf current proxy server configuration
638 * @param worker worker used for retrying
639 * @param s current server record
640 * @return OK if marked for retry, DECLINED otherwise
641 * @note Worker will be marker for retry if the time of the last retry
642 * has been ellapsed. In case there is no retry option set, defaults to
643 * number_of_retries seconds.
645 PROXY_DECLARE(int) ap_proxy_retry_worker(const char *proxy_function,
646 proxy_worker *worker,
649 * Acquire a connection from workers connection pool
650 * @param proxy_function calling proxy scheme (http, ajp, ...)
651 * @param conn acquired connection
652 * @param worker worker used for obtaining connection
653 * @param s current server record
654 * @return OK or HTTP_XXX error
655 * @note If the number of connections is exhaused the function will
656 * block untill the timeout is reached.
658 PROXY_DECLARE(int) ap_proxy_acquire_connection(const char *proxy_function,
659 proxy_conn_rec **conn,
660 proxy_worker *worker,
663 * Release a connection back to worker connection pool
664 * @param proxy_function calling proxy scheme (http, ajp, ...)
665 * @param conn acquired connection
666 * @param s current server record
667 * @return OK or HTTP_XXX error
668 * @note The connection will be closed if conn->close_on_release is set
670 PROXY_DECLARE(int) ap_proxy_release_connection(const char *proxy_function,
671 proxy_conn_rec *conn,
674 * Make a connection to the backend
675 * @param proxy_function calling proxy scheme (http, ajp, ...)
676 * @param conn acquired connection
677 * @param worker connection worker
678 * @param s current server record
679 * @return OK or HTTP_XXX error
680 * @note In case the socket already exists for conn, just check the link
683 PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function,
684 proxy_conn_rec *conn,
685 proxy_worker *worker,
688 * Make a connection record for backend connection
689 * @param proxy_function calling proxy scheme (http, ajp, ...)
690 * @param conn acquired connection
691 * @param c client connection record
692 * @param s current server record
693 * @return OK or HTTP_XXX error
695 PROXY_DECLARE(int) ap_proxy_connection_create(const char *proxy_function,
696 proxy_conn_rec *conn,
697 conn_rec *c, server_rec *s);
699 * Signal the upstream chain that the connection to the backend broke in the
700 * middle of the response. This is done by sending an error bucket with
701 * status HTTP_BAD_GATEWAY and an EOS bucket up the filter chain.
702 * @param r current request record of client request
703 * @param brigade The brigade that is sent through the output filter chain
705 PROXY_DECLARE(void) ap_proxy_backend_broke(request_rec *r,
706 apr_bucket_brigade *brigade);
709 #if MODULE_MAGIC_NUMBER_MAJOR > 20020903
710 #define PROXY_HAS_SCOREBOARD 1
712 #define PROXY_HAS_SCOREBOARD 0
715 #define PROXY_LBMETHOD "proxylbmethod"
717 /* The number of dynamic workers that can be added when reconfiguring.
718 * If this limit is reached you must stop and restart the server.
720 #define PROXY_DYNAMIC_BALANCER_LIMIT 16
722 * Calculate number of maximum number of workers in scoreboard.
723 * @return number of workers to allocate in the scoreboard
725 int ap_proxy_lb_workers(void);
728 extern module PROXY_DECLARE_DATA proxy_module;
730 extern int PROXY_DECLARE_DATA proxy_lb_workers;
732 #endif /*MOD_PROXY_H*/