You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-cvs@httpd.apache.org by je...@apache.org on 2004/08/03 12:22:15 UTC

cvs commit: httpd-test/flood CHANGES config.h.in flood_net.c flood_profile.h flood_round_robin.c

jerenkrantz    2004/08/03 03:22:15

  Modified:    flood    CHANGES config.h.in flood_net.c flood_profile.h
                        flood_round_robin.c
  Log:
  * Add <proxyurl> child element to <urllist> to request against a proxy.
  * Accept HTTP/1.0 responses to HTTP/1.1 requests.
  
  Revision  Changes    Path
  1.54      +5 -0      httpd-test/flood/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-test/flood/CHANGES,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -u -r1.53 -r1.54
  --- CHANGES	2 Aug 2004 23:55:38 -0000	1.53
  +++ CHANGES	3 Aug 2004 10:22:14 -0000	1.54
  @@ -1,5 +1,10 @@
   Changes since 1.0:
   
  +* Add <proxyurl> child element to <urllist> to request against a proxy.
  +  [Justin Erenkrantz]
  +
  +* Accept HTTP/1.0 responses to HTTP/1.1 requests.  [Justin Erenkrantz]
  +
   * Use APR's bundled mkdir script.  [Justin Erenkrantz]
   
   * Support VPATH builds again.  [Justin Erenkrantz]
  
  
  
  1.32      +1 -0      httpd-test/flood/config.h.in
  
  Index: config.h.in
  ===================================================================
  RCS file: /home/cvs/httpd-test/flood/config.h.in,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -u -r1.31 -r1.32
  --- config.h.in	18 Mar 2004 18:28:08 -0000	1.31
  +++ config.h.in	3 Aug 2004 10:22:14 -0000	1.32
  @@ -16,6 +16,7 @@
   #define XML_URLLIST_SEQUENCE_NAME "sequencename"
   #define XML_URLLIST_SEQUENCE_LIST "sequencelist"
   #define XML_URLLIST_BASE_URL "baseurl"
  +#define XML_URLLIST_PROXY_URL "proxyurl"
   #define XML_URLLIST_URL "url"
   #define XML_URLLIST_METHOD "method"
   #define XML_URLLIST_METHOD_GET "get"
  
  
  
  1.18      +9 -2      httpd-test/flood/flood_net.c
  
  Index: flood_net.c
  ===================================================================
  RCS file: /home/cvs/httpd-test/flood/flood_net.c,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -u -r1.17 -r1.18
  --- flood_net.c	9 Feb 2004 08:12:56 -0000	1.17
  +++ flood_net.c	3 Aug 2004 10:22:14 -0000	1.18
  @@ -26,11 +26,18 @@
       apr_status_t rv = 0;
       apr_sockaddr_t *destsa;
       flood_socket_t* fs;
  +    apr_uri_t *u;
       
       fs = apr_palloc(pool, sizeof(flood_socket_t));
  +    if (r->parsed_proxy_uri) {
  +        u = r->parsed_proxy_uri;
  +    }
  +    else {
  +        u = r->parsed_uri;
  +    }
   
  -    if ((rv = apr_sockaddr_info_get(&destsa, r->parsed_uri->hostname, APR_INET, 
  -                                    r->parsed_uri->port, 0, pool)) 
  +    if ((rv = apr_sockaddr_info_get(&destsa, u->hostname, APR_INET,
  +                                    u->port, 0, pool)) 
                                       != APR_SUCCESS) {
           if (status) {
               *status = rv;
  
  
  
  1.18      +1 -1      httpd-test/flood/flood_profile.h
  
  Index: flood_profile.h
  ===================================================================
  RCS file: /home/cvs/httpd-test/flood/flood_profile.h,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -u -r1.17 -r1.18
  --- flood_profile.h	18 Mar 2004 18:28:08 -0000	1.17
  +++ flood_profile.h	3 Aug 2004 10:22:14 -0000	1.18
  @@ -61,7 +61,6 @@
   struct request_t {
       /* The basic components to connect to the server */
       char * uri;
  -    char * proxy_url;
   
       method_e method;
       int keepalive; /* a boolean */
  @@ -74,6 +73,7 @@
       char * contenttype;
       
       apr_uri_t *parsed_uri;
  +    apr_uri_t *parsed_proxy_uri;
   
       /* Raw buffer connection 
        * FIXME: apr_bucket_t? */ 
  
  
  
  1.42      +33 -7     httpd-test/flood/flood_round_robin.c
  
  Index: flood_round_robin.c
  ===================================================================
  RCS file: /home/cvs/httpd-test/flood/flood_round_robin.c,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -u -r1.41 -r1.42
  --- flood_round_robin.c	18 Mar 2004 18:28:08 -0000	1.41
  +++ flood_round_robin.c	3 Aug 2004 10:22:14 -0000	1.42
  @@ -103,6 +103,7 @@
       int urls;
       url_t *url;
       char *baseurl;
  +    apr_uri_t *proxy_url;
   
       cookie_t *cookie;
   
  @@ -214,7 +215,7 @@
   apr_status_t round_robin_create_req(profile_t *profile, request_t *r)
   {
       round_robin_profile_t *p;
  -    char *cookies;
  +    char *cookies, *path;
       char *enc_credtls, *credtls, *authz_hdr = NULL;
       cookie_t *cook;
      
  @@ -261,6 +262,15 @@
           }
       }
   
  +    if (p->proxy_url != NULL) {
  +        path = apr_pstrcat(r->pool, r->parsed_uri->scheme, "://",
  +                                    r->parsed_uri->hostinfo,
  +                                    r->parsed_uri->path, NULL);
  +    }
  +    else {
  +        path = r->parsed_uri->path;
  +    }
  +
       switch (r->method)
       {
       case GET:
  @@ -271,7 +281,7 @@
                                  "Host: %s" CRLF 
                                  "%s"
                                  "%s" CRLF,
  -                               r->parsed_uri->path, 
  +                               path,
                                  r->parsed_uri->query ? "?" : "",
                                  r->parsed_uri->query ? r->parsed_uri->query : "",
                                  r->keepalive ? "Keep-Alive" : "Close",
  @@ -289,7 +299,7 @@
                                  "Host: %s" CRLF 
                                  "%s"
                                  "%s" CRLF,
  -                               r->parsed_uri->path, 
  +                               path, 
                                  r->parsed_uri->query ? "?" : "",
                                  r->parsed_uri->query ? r->parsed_uri->query : "",
                                  r->keepalive ? "Keep-Alive" : "Close",
  @@ -312,7 +322,7 @@
                                      "%s"
                                      "%s" CRLF
                                      "%s",
  -                                   r->parsed_uri->path, 
  +                                   path, 
                                      r->parsed_uri->query ? "?" : "",
                                      r->parsed_uri->query ? r->parsed_uri->query : "",
                                      r->keepalive ? "Keep-Alive" : "Close",
  @@ -331,7 +341,7 @@
   
                                      "%s"
                                      "%s" CRLF "",
  -                                   r->parsed_uri->path, 
  +                                   path, 
                                      r->parsed_uri->query ? "?" : "",
                                      r->parsed_uri->query ? r->parsed_uri->query : "",
                                      r->keepalive ? "Keep-Alive" : "Close",
  @@ -642,7 +652,8 @@
       apr_status_t rv;
       int i;
       struct apr_xml_elem *root_elem, *profile_elem,
  -           *urllist_elem, *count_elem, *useurllist_elem, *baseurl_elem, *e;
  +           *urllist_elem, *count_elem, *useurllist_elem, *baseurl_elem,
  +           *proxyurl_elem, *e;
       round_robin_profile_t *p;
       char *xml_profile, *xml_urllist, *urllist_name;
   
  @@ -719,6 +730,17 @@
           p->baseurl = NULL;
       }
   
  +    /* do we have proxy url? */
  +    if ((rv = retrieve_xml_elem_child(
  +             &proxyurl_elem, urllist_elem, XML_URLLIST_PROXY_URL)) == APR_SUCCESS) {
  +        /* yes we do */
  +        p->proxy_url = apr_pcalloc(p->pool, sizeof(apr_uri_t));
  +        apr_uri_parse(p->pool, proxyurl_elem->first_cdata.first->text,
  +                      p->proxy_url);
  +    } else {
  +        p->proxy_url = NULL;
  +    }
  +
       p->urls = 0;
       /* Include sequences.  We'll expand them later. */
       p->urls = count_xml_seq_child(urllist_elem);
  @@ -819,7 +841,7 @@
   
       }
   
  -    r->parsed_uri = apr_pcalloc(rp->pool, sizeof(apr_uri_t));
  +    r->parsed_uri = apr_palloc(rp->pool, sizeof(apr_uri_t));
   
       if (rp->baseurl != NULL) {
           r->uri = apr_pstrcat(rp->pool, rp->baseurl, r->uri, NULL);
  @@ -857,6 +879,8 @@
       if (!r->parsed_uri->path) /* If / is not there, be nice.  */
           r->parsed_uri->path = "/";
   
  +    r->parsed_proxy_uri = rp->proxy_url;
  +
   #ifdef PROFILE_DEBUG
       apr_file_printf(local_stdout, "Generating request to: %s\n", r->uri);
   #endif /* PROFILE_DEBUG */
  @@ -1076,6 +1100,8 @@
       if (!res)
           *verified = FLOOD_VALID;
       else if (memcmp(resp->rbuf + 9, "3", 1) == 0) /* Accept 3xx as okay. */
  +        *verified = FLOOD_VALID;
  +    else if (memcmp(resp->rbuf, "HTTP/1.0 2", 10) == 0) /* HTTP/1.0 is ok. */
           *verified = FLOOD_VALID;
       else
           *verified = FLOOD_INVALID;