Things to do:
- 1. Make it garbage collect in the background, not while someone is
- waiting for a response!
+ 1. Make it garbage collect in the background, not while someone is waiting for
+ a response!
2. Check the logic thoroughly.
- 3. Empty directories are only removed the next time round (but this does
- avoid two passes). Consider doing them the first time round.
+ 3. Empty directories are only removed the next time round (but this does avoid
+ two passes). Consider doing them the first time round.
Ben Laurie <ben@algroup.co.uk> 30 Mar 96
*/
-#define TESTING 0
+#define TESTING 0
#undef EXPLAIN
#include "httpd.h"
#include "explain.h"
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
extern module MODULE_VAR_EXPORT proxy_module;
enc_path, enc_search, enc_user, enc_fpath, enc_parm
};
-#define HDR_APP (0) /* append header, for proxy_add_header() */
-#define HDR_REP (1) /* replace header, for proxy_add_header() */
+#define HDR_APP (0) /* append header, for proxy_add_header() */
+#define HDR_REP (1) /* replace header, for proxy_add_header() */
#ifdef CHARSET_EBCDIC
#define CRLF "\r\n"
#define CRLF "\015\012"
#endif /*CHARSET_EBCDIC*/
-#define DEFAULT_FTP_DATA_PORT 20
-#define DEFAULT_FTP_PORT 21
-#define DEFAULT_GOPHER_PORT 70
-#define DEFAULT_NNTP_PORT 119
-#define DEFAULT_WAIS_PORT 210
-#define DEFAULT_HTTPS_PORT 443
-#define DEFAULT_SNEWS_PORT 563
-#define DEFAULT_PROSPERO_PORT 1525 /* WARNING: conflict w/Oracle */
+#define DEFAULT_FTP_DATA_PORT 20
+#define DEFAULT_FTP_PORT 21
+#define DEFAULT_GOPHER_PORT 70
+#define DEFAULT_NNTP_PORT 119
+#define DEFAULT_WAIS_PORT 210
+#define DEFAULT_HTTPS_PORT 443
+#define DEFAULT_SNEWS_PORT 563
+#define DEFAULT_PROSPERO_PORT 1525 /* WARNING: conflict w/Oracle */
#define DEFAULT_CACHE_COMPLETION (0.9)
/* Some WWW schemes and their default ports; this is basically /etc/services */
/* static information about a remote proxy */
struct proxy_remote {
- const char *scheme; /* the schemes handled by this proxy, or '*' */
- const char *protocol; /* the scheme used to talk to this proxy */
- const char *hostname; /* the hostname of this proxy */
- int port; /* the port for this proxy */
+ const char *scheme; /* the schemes handled by this proxy, or '*' */
+ const char *protocol; /* the scheme used to talk to this proxy */
+ const char *hostname; /* the hostname of this proxy */
+ int port; /* the port for this proxy */
};
struct proxy_alias {
ap_array_header_t *dirconn;
ap_array_header_t *nocaches;
ap_array_header_t *allowed_connect_ports;
- char *domain; /* domain name to use in absence of
- a domain name in the request */
- int req; /* true if proxy requests are enabled */
- float cache_completion; /* Force cache completion after this point */
+ char *domain; /* domain name to use in absence of a domain name in the request */
+ int req; /* true if proxy requests are enabled */
+ float cache_completion; /* Force cache completion after this point */
enum {
via_off,
via_on,
via_full
} viaopt; /* how to deal with proxy Via: headers */
size_t recv_buffer_size;
- ap_cache_handle_t *cache;
+ ap_cache_handle_t *cache;
} proxy_server_conf;
typedef struct {
- float cache_completion; /* completion percentage */
- int content_length; /* length of the content */
+ float cache_completion; /* completion percentage */
+ int content_length; /* length of the content */
} proxy_completion;
/* Function prototypes */
/* proxy_connect.c */
int ap_proxy_connect_handler(request_rec *r, ap_cache_el *c, char *url,
- const char *proxyhost, int proxyport);
+ const char *proxyhost, int proxyport);
/* proxy_ftp.c */
/* proxy_http.c */
int ap_proxy_http_canon(request_rec *r, char *url, const char *scheme,
- int def_port);
+ int def_port);
int ap_proxy_http_handler(request_rec *r, ap_cache_el *c, char *url,
- const char *proxyhost, int proxyport);
+ const char *proxyhost, int proxyport);
/* proxy_util.c */
int ap_proxy_hex2c(const char *x);
void ap_proxy_c2hex(int ch, char *x);
char *ap_proxy_canonenc(ap_pool_t *p, const char *x, int len, enum enctype t,
- int isenc);
+ int isenc);
char *ap_proxy_canon_netloc(ap_pool_t *p, char **const urlp, char **userp,
- char **passwordp, char **hostp, int *port);
+ char **passwordp, char **hostp, int *port);
const char *ap_proxy_date_canon(ap_pool_t *p, const char *x);
ap_table_t *ap_proxy_read_headers(request_rec *r, char *buffer, int size, BUFF *f);
long int ap_proxy_send_fb(proxy_completion *, BUFF *f, request_rec *r, ap_cache_el *c);
int ap_proxy_hex2sec(const char *x);
void ap_proxy_sec2hex(int t, char *y);
const char *ap_proxy_host2addr(const char *host, struct hostent *reqhp);
+int ap_proxy_cache_send(request_rec *r, ap_cache_el *c);
+int ap_proxy_cache_should_cache(request_rec *r, ap_table_t *resp_hdrs,
+ const int is_HTTP1);
+int ap_proxy_cache_update(ap_cache_el *c);
void ap_proxy_cache_error(ap_cache_el **r);
int ap_proxyerror(request_rec *r, int statuscode, const char *message);
int ap_proxy_is_ipaddr(struct dirconn_entry *This, ap_pool_t *p);