]> granicus.if.org Git - apache/commitdiff
Compiler warnings - yuck!
authorGraham Leggett <minfrin@apache.org>
Tue, 10 Apr 2001 00:13:56 +0000 (00:13 +0000)
committerGraham Leggett <minfrin@apache.org>
Tue, 10 Apr 2001 00:13:56 +0000 (00:13 +0000)
Moved ap_proxy_string_read() to proxy_util.c so it can be used by
proxy_http.c
PR:
Obtained from:
Reviewed by:

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

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

index 2970e90d76c3e522bb133efe8c072e5b5b80704c..e34ef81735a3deec00d077a5d8f657e2edfecc45 100644 (file)
@@ -210,7 +210,6 @@ apr_status_t ap_proxy_null_filter(ap_filter_t *f, apr_bucket_brigade *bb);
 int ap_proxy_ftp_canon(request_rec *r, char *url);
 int ap_proxy_ftp_handler(request_rec *r, char *url);
 apr_status_t ap_proxy_send_dir_filter(ap_filter_t *f, apr_bucket_brigade *bb);
-apr_status_t ap_proxy_string_read(conn_rec *c, apr_bucket_brigade *bb, char *buff, size_t bufflen);
 
 
 /* proxy_http.c */
@@ -243,5 +242,6 @@ int ap_proxy_is_hostname(struct dirconn_entry *This, apr_pool_t *p);
 int ap_proxy_is_word(struct dirconn_entry *This, apr_pool_t *p);
 int ap_proxy_checkproxyblock(request_rec *r, proxy_server_conf *conf, apr_sockaddr_t *uri_addr);
 int ap_proxy_pre_http_connection(conn_rec *c, request_rec *r);
+apr_status_t ap_proxy_string_read(conn_rec *c, apr_bucket_brigade *bb, char *buff, size_t bufflen);
 
 #endif /*MOD_PROXY_H*/
index dceca70f2ee8c13f852cb3c90e708f28b483db67..67f15c1b76c2360b68f7c1d3f43e501731b7f8c2 100644 (file)
@@ -183,58 +183,6 @@ int ap_proxy_ftp_canon(request_rec *r, char *url)
     return OK;
 }
 
-apr_status_t ap_proxy_string_read(conn_rec *c, apr_bucket_brigade *bb, char *buff, size_t bufflen);
-
-/* converts a series of buckets into a string */
-apr_status_t ap_proxy_string_read(conn_rec *c, apr_bucket_brigade *bb, char *buff, size_t bufflen)
-{
-    apr_bucket *e;
-    apr_status_t rv;
-    char *pos = buff;
-    char *response;
-    int found = 0;
-    size_t len;
-
-    /* start with an empty string */
-    buff[0] = 0;
-
-    /* get line-at-a-time */
-    c->remain = 0;
-
-    /* loop through each brigade */
-    while (!found) {
-
-       /* get brigade from network */
-       if (APR_SUCCESS != (rv = ap_get_brigade(c->input_filters, bb, AP_MODE_BLOCKING))) {
-           return rv;
-       }
-
-       /* loop through each bucket */
-       while (!found && !APR_BRIGADE_EMPTY(bb)) {
-           e = APR_BRIGADE_FIRST(bb);
-           if (APR_SUCCESS != apr_bucket_read(e, (const char **)&response, &len, APR_BLOCK_READ)) {
-               return rv;
-           }
-           /* is string LF terminated? */
-           if (memchr(response, APR_ASCII_LF, len)) {
-               found = 1;
-           }
-           /* concat strings until buff is full - then throw the data away */
-           if (len > ((bufflen-1)-(pos-buff))) {
-               len = (bufflen-1)-(pos-buff);
-           }
-           if (len > 0) {
-               pos = apr_cpystrn(pos, response, len);
-           }
-           APR_BUCKET_REMOVE(e);
-           apr_bucket_destroy(e);
-       }
-    }
-
-    return APR_SUCCESS;
-
-}
-
 /* we chop lines longer than 80 characters */
 #define MAX_LINE_LEN 80
 
@@ -244,7 +192,7 @@ apr_status_t ap_proxy_string_read(conn_rec *c, apr_bucket_brigade *bb, char *buf
  */
 static int ftp_getrc_msg(conn_rec *c, apr_bucket_brigade *bb, char *msgbuf, int msglen)
 {
-    int len = 0, status;
+    int status;
     char response[MAX_LINE_LEN];
     char buff[5];
     char *mb = msgbuf,
@@ -263,30 +211,13 @@ static int ftp_getrc_msg(conn_rec *c, apr_bucket_brigade *bb, char *msgbuf, int
 
     mb = apr_cpystrn(mb, response+4, me - mb);
 
-    ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, c->base_server,
-                "proxy: FTP: line [%s]", response);
-
     if (response[3] == '-') {
        memcpy(buff, response, 3);
        buff[3] = ' ';
        do {
-
            if (APR_SUCCESS != (rv = ap_proxy_string_read(c, bb, response, sizeof(response)))) {
                return -1;
            }
-           len = strlen(response);
-           if (len == 0) {
-               ap_log_error(APLOG_MARK, APLOG_ERR, rv, c->base_server,
-                            "proxy: FTP: apr_bucket_read() returned zero data [%s]", response);
-               return -1;
-           }
-           else if ((len < 4) && (' ' != response[0])) {
-               return -1;
-           }
-
-           ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, c->base_server,
-                        "proxy: FTP: line [%s]", response);
-
            mb = apr_cpystrn(mb, response + (' ' == response[0] ? 1 : 4), me - mb);
        } while (memcmp(response, buff, 4) != 0);
     }
@@ -497,7 +428,7 @@ int ap_proxy_ftp_handler(request_rec *r, char *url)
     apr_bucket *e;
     apr_bucket_brigade *bb = apr_brigade_create(p);
     apr_bucket_brigade *cbb = apr_brigade_create(p);
-    char *buf, *pasv, *connectname;
+    char *buf, *connectname;
     apr_port_t connectport;
     char buffer[MAX_STRING_LEN];
     char *path, *strp, *parms;
@@ -957,7 +888,7 @@ int ap_proxy_ftp_handler(request_rec *r, char *url)
        return ap_proxyerror(r, HTTP_BAD_GATEWAY, buffer);
     }
     else if (i == 227) {
-       unsigned int presult, h0, h1, h2, h3, p0, p1;
+       unsigned int h0, h1, h2, h3, p0, p1;
        char *pstr;
 
        pstr = apr_pstrdup(p, buffer);
@@ -1018,7 +949,7 @@ int ap_proxy_ftp_handler(request_rec *r, char *url)
            /* and try the regular way */
            apr_socket_close(remote_sock);
     }
-bypass:
+/*bypass:*/
 
     /* set up data connection */
     if (!pasvmode) {
index e4b02fd4109c12387d6b9a679cc6616b8bbe1f98..dec2ca41f3e12f6147fcd35eb60d1fb478904c80 100644 (file)
@@ -1081,6 +1081,55 @@ int ap_proxy_pre_http_connection(conn_rec *c, request_rec *r)
     return OK;
 }
 
+/* converts a series of buckets into a string */
+apr_status_t ap_proxy_string_read(conn_rec *c, apr_bucket_brigade *bb, char *buff, size_t bufflen)
+{
+    apr_bucket *e;
+    apr_status_t rv;
+    char *pos = buff;
+    char *response;
+    int found = 0;
+    size_t len;
+
+    /* start with an empty string */
+    buff[0] = 0;
+
+    /* get line-at-a-time */
+    c->remain = 0;
+
+    /* loop through each brigade */
+    while (!found) {
+
+       /* get brigade from network */
+       if (APR_SUCCESS != (rv = ap_get_brigade(c->input_filters, bb, AP_MODE_BLOCKING))) {
+           return rv;
+       }
+
+       /* loop through each bucket */
+       while (!found && !APR_BRIGADE_EMPTY(bb)) {
+           e = APR_BRIGADE_FIRST(bb);
+           if (APR_SUCCESS != apr_bucket_read(e, (const char **)&response, &len, APR_BLOCK_READ)) {
+               return rv;
+           }
+           /* is string LF terminated? */
+           if (memchr(response, APR_ASCII_LF, len)) {
+               found = 1;
+           }
+           /* concat strings until buff is full - then throw the data away */
+           if (len > ((bufflen-1)-(pos-buff))) {
+               len = (bufflen-1)-(pos-buff);
+           }
+           if (len > 0) {
+               pos = apr_cpystrn(pos, response, len);
+           }
+           APR_BUCKET_REMOVE(e);
+           apr_bucket_destroy(e);
+       }
+    }
+
+    return APR_SUCCESS;
+
+}
 
 #if defined WIN32