]> granicus.if.org Git - apache/commitdiff
OK, this builds and is autoconf safe about system headers, until it starts
authorChuck Murcko <chuck@apache.org>
Tue, 13 Jun 2000 01:22:09 +0000 (01:22 +0000)
committerChuck Murcko <chuck@apache.org>
Tue, 13 Jun 2000 01:22:09 +0000 (01:22 +0000)
using APR
PR:
Obtained from:
Submitted by: Chuck Murcko
Reviewed by:

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85562 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/mod_proxy.h
modules/proxy/proxy_http.c

index abda37568a29e358a8d6df87cfab92a0b90df60e..4007b87816feccf35b0c76bb0875b2647e10a17b 100644 (file)
 
    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;
 
 
@@ -121,8 +137,8 @@ enum enctype {
     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"
@@ -130,14 +146,14 @@ enum enctype {
 #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 */
@@ -148,10 +164,10 @@ struct proxy_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 {
@@ -184,10 +200,9 @@ typedef struct {
     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,
@@ -195,12 +210,12 @@ typedef struct {
       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 */
@@ -208,7 +223,7 @@ typedef struct {
 /* 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 */
 
@@ -218,18 +233,18 @@ int ap_proxy_ftp_handler(request_rec *r, ap_cache_el *c, char *url);
 /* 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);
@@ -239,6 +254,10 @@ void ap_proxy_hash(const char *it, char *val, int ndepth, int nlength);
 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);
index b4cf2a280996bcb063420e9c07f16dc5da18cc67..712c86f1f8d5da026c6aa7a47770787ff110af5d 100644 (file)
@@ -456,7 +456,7 @@ int ap_proxy_http_handler(request_rec *r, ap_cache_el  *c, char *url,
         ap_bwrite(r->connection->client, buffer, len, &cntr);
         if (cachefp && ap_bwrite(cachefp, buffer, len, &cntr) != len) {
             ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
-                          "proxy: error writing extra data to cache", cachefp);
+                          "proxy: error writing extra data to cache");
             ap_proxy_cache_error(&c);
         }
     }