You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by mi...@apache.org on 2001/04/10 02:13:57 UTC

cvs commit: httpd-proxy/module-2.0 mod_proxy.h proxy_ftp.c proxy_util.c

minfrin     01/04/09 17:13:57

  Modified:    module-2.0 mod_proxy.h proxy_ftp.c proxy_util.c
  Log:
  Compiler warnings - yuck!
  Moved ap_proxy_string_read() to proxy_util.c so it can be used by
  proxy_http.c
  
  Revision  Changes    Path
  1.41      +1 -1      httpd-proxy/module-2.0/mod_proxy.h
  
  Index: mod_proxy.h
  ===================================================================
  RCS file: /home/cvs/httpd-proxy/module-2.0/mod_proxy.h,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- mod_proxy.h	2001/04/09 21:49:17	1.40
  +++ mod_proxy.h	2001/04/10 00:13:56	1.41
  @@ -210,7 +210,6 @@
   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_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*/
  
  
  
  1.39      +4 -73     httpd-proxy/module-2.0/proxy_ftp.c
  
  Index: proxy_ftp.c
  ===================================================================
  RCS file: /home/cvs/httpd-proxy/module-2.0/proxy_ftp.c,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- proxy_ftp.c	2001/04/09 21:49:17	1.38
  +++ proxy_ftp.c	2001/04/10 00:13:56	1.39
  @@ -183,58 +183,6 @@
       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 @@
    */
   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 @@
   
       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 @@
       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 @@
   	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 @@
   	    /* and try the regular way */
   	    apr_socket_close(remote_sock);
       }
  -bypass:
  +/*bypass:*/
   
       /* set up data connection */
       if (!pasvmode) {
  
  
  
  1.50      +49 -0     httpd-proxy/module-2.0/proxy_util.c
  
  Index: proxy_util.c
  ===================================================================
  RCS file: /home/cvs/httpd-proxy/module-2.0/proxy_util.c,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- proxy_util.c	2001/04/06 14:25:54	1.49
  +++ proxy_util.c	2001/04/10 00:13:56	1.50
  @@ -1081,6 +1081,55 @@
       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