]> granicus.if.org Git - apache/commitdiff
proxy_ftp and proxy_http both compile now. Not tested because the rest of
authorRyan Bloom <rbb@apache.org>
Sat, 11 Nov 2000 18:13:04 +0000 (18:13 +0000)
committerRyan Bloom <rbb@apache.org>
Sat, 11 Nov 2000 18:13:04 +0000 (18:13 +0000)
the proxy is still not compiling, but we are making progress.

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

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

index 16e5a7bad8b6a41e1a771e887318304e0701cd8b..1036c6a365b4850a1dd5c27c5876a7b5d9e22372 100644 (file)
@@ -277,6 +277,6 @@ int ap_proxy_doconnect(apr_socket_t *sock, char *host, apr_uint32_t port, reques
 int ap_proxy_garbage_init(server_rec *, apr_pool_t *);
 /* This function is called by ap_table_do() for all header lines */
 int ap_proxy_send_hdr_line(void *p, const char *key, const char *value);
-unsigned ap_proxy_bputs2(const char *data, BUFF *client, ap_cache_el *cache);
+unsigned ap_proxy_bputs2(const char *data, apr_socket_t *client, ap_cache_el *cache);
 
 #endif /*MOD_PROXY_H*/
index 94c64e3d5f821edd32789606908d35696bada001..68506bf4d0edba7141cf3b247e424d3f6b4d9e32 100644 (file)
@@ -310,7 +310,7 @@ static long int send_dir(BUFF *f, request_rec *r, ap_cache_el  *c, char *cwd)
                "<BODY><H2>Directory of "
                "<A HREF=\"/\">%s</A>/",
                site, path, site, path, site);
-    total_bytes_sent += ap_proxy_bputs2(buf, con->client, c);
+    total_bytes_sent += ap_proxy_bputs2(buf, con->client_socket, c);
 
     while ((dir = strchr(dir+1, '/')) != NULL)
     {
@@ -321,7 +321,7 @@ static long int send_dir(BUFF *f, request_rec *r, ap_cache_el  *c, char *cwd)
            ++reldir;
        /* print "path/" component */
        apr_snprintf(buf, sizeof(buf), "<A HREF=\"/%s/\">%s</A>/", path+1, reldir);
-       total_bytes_sent += ap_proxy_bputs2(buf, con->client, c);
+       total_bytes_sent += ap_proxy_bputs2(buf, con->client_socket, c);
        *dir = '/';
     }
     /* If the caller has determined the current directory, and it differs */
@@ -331,7 +331,7 @@ static long int send_dir(BUFF *f, request_rec *r, ap_cache_el  *c, char *cwd)
     } else {
        apr_snprintf(buf, sizeof(buf), "</H2>\n(%s)\n<HR><PRE>", cwd);
     }
-    total_bytes_sent += ap_proxy_bputs2(buf, con->client, c);
+    total_bytes_sent += ap_proxy_bputs2(buf, con->client_socket, c);
 
     while (!con->aborted) {
        n = ap_bgets(buf, sizeof buf, f);
@@ -408,7 +408,8 @@ static long int send_dir(BUFF *f, request_rec *r, ap_cache_el  *c, char *cwd)
        }
 
        while (n && !r->connection->aborted) {
-           w = ap_bwrite(con->client, &buf[o], n, &cntr);
+            cntr = n;
+           w = apr_send(con->client_socket, &buf[o], &cntr);
            if (w <= 0)
                break;
            n -= w;
@@ -416,12 +417,14 @@ static long int send_dir(BUFF *f, request_rec *r, ap_cache_el  *c, char *cwd)
        }
     }
 
-    total_bytes_sent += ap_proxy_bputs2("</PRE><HR>\n", con->client, c);
-    total_bytes_sent += ap_proxy_bputs2(ap_psignature("", r), con->client, c);
-    total_bytes_sent += ap_proxy_bputs2("</BODY></HTML>\n", con->client, c);
-
-    ap_bflush(con->client);
+    total_bytes_sent += ap_proxy_bputs2("</PRE><HR>\n", con->client_socket, c);
+    total_bytes_sent += ap_proxy_bputs2(ap_psignature("", r), con->client_socket, c);
+    total_bytes_sent += ap_proxy_bputs2("</BODY></HTML>\n", con->client_socket, c);
 
+/* Flushing the actual socket doesn't make much sense, because we don't 
+ * buffer it yet.
+    ap_flush(con->client);
+*/
     return total_bytes_sent;
 }
 
@@ -492,7 +495,7 @@ int ap_proxy_ftp_handler(request_rec *r, ap_cache_el *c, char *url)
     char *pstr, dates[AP_RFC822_DATE_LEN];
 
     char *npaddr;
-    apr_uint32_t npport;
+    apr_port_t npport;
        
 /* stuff for responses */
     char resp[MAX_STRING_LEN];
@@ -867,10 +870,10 @@ int ap_proxy_ftp_handler(request_rec *r, ap_cache_el *c, char *url)
            ap_bclose(f);
            return HTTP_INTERNAL_SERVER_ERROR;
        }
-        apr_get_local_port(&npport, sock);
-        apr_get_local_ipaddr(&npaddr, sock);
-        apr_set_local_port(dsock, npport);
-        apr_set_local_ipaddr(dsock, npaddr);
+        apr_get_port(&npport, APR_LOCAL, sock);
+        apr_get_ipaddr(&npaddr, APR_LOCAL, sock);
+        apr_set_port(dsock, APR_LOCAL, npport);
+        apr_set_ipaddr(dsock, APR_LOCAL, npaddr);
 
        if (apr_setsocketopt(dsock, APR_SO_REUSEADDR, one) != APR_SUCCESS) {
 #ifndef _OSD_POSIX /* BS2000 has this option "always on" */
@@ -1195,7 +1198,9 @@ int ap_proxy_ftp_handler(request_rec *r, ap_cache_el *c, char *url)
         cachefp = NULL;
     }
 
+/* This is done by a filter now, so this can probably be removed cleanly.
     ap_bsetopt(r->connection->client, BO_BYTECT, &zero);
+*/
     r->sent_bodyct = 1;
 /* send body */
     if (!r->header_only) {
index b26a2ed13193d794e4cfb836e8b91231e40ec1a9..8b690c05fe6abcd984ea9f4d9911a976fd5206ab 100644 (file)
@@ -455,11 +455,15 @@ int ap_proxy_http_handler(request_rec *r, ap_cache_el *c, char *url,
     if (!r->assbackwards)
        ap_rputs(CRLF, r);
 
+/* We don't set byte count this way anymore.  I think this can be removed
+ * cleanly now.
     ap_bsetopt(r->connection->client, BO_BYTECT, &zero);
+*/
     r->sent_bodyct = 1;
 /* Is it an HTTP/0.9 response? If so, send the extra data */
     if (backasswards) {
-       ap_bwrite(r->connection->client, buffer, len, &cntr);
+        cntr = len;
+       apr_send(r->connection->client_socket, buffer, &cntr);
         cntr = len;
         if (cachefp && apr_write(cachefp, buffer, &cntr) != APR_SUCCESS) {
            ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
index 4b6b2139b52b9558a08b3ac719ac9897f610fb08..6064d7d861fb9a14a69aad0993eb81c08f49daa3 100644 (file)
@@ -1168,9 +1168,10 @@ int ap_proxy_send_hdr_line(void *p, const char *key, const char *value)
 }
 
 /* send a text line to one or two BUFF's; return line length */
-unsigned ap_proxy_bputs2(const char *data, BUFF *client, ap_cache_el *cache)
+unsigned ap_proxy_bputs2(const char *data, apr_socket_t *client, ap_cache_el *cache)
 {
-    unsigned len = ap_bputs(data, client);
+    unsigned len = strlen(data);
+    apr_send(client, data, &len);
     apr_file_t *cachefp = NULL;
 
     if (ap_cache_el_data(cache, &cachefp) == APR_SUCCESS)