httpd-test-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jac...@apache.org
Subject cvs commit: httpd-test/flood flood_round_robin.c
Date Mon, 09 Sep 2002 09:24:28 GMT
jacekp      2002/09/09 02:24:28

  Modified:    flood    flood_round_robin.c
  Log:
  fixed few code blocks to be 'style guide' compilant
  
  Revision  Changes    Path
  1.30      +30 -17    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.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- flood_round_robin.c	6 Sep 2002 10:16:09 -0000	1.29
  +++ flood_round_robin.c	9 Sep 2002 09:24:28 -0000	1.30
  @@ -247,7 +247,6 @@
   apr_status_t round_robin_create_req(profile_t *profile, request_t *r)
   {
       round_robin_profile_t *p;
  -    int crdlen;
       char *cookies;
       char *enc_credtls, *credtls, *authz_hdr = NULL;
       cookie_t *cook;
  @@ -278,15 +277,21 @@
   
       if (p->url[p->current_url].user) {
           if (!p->url[p->current_url].password) {
  -            apr_file_printf(local_stderr, "missing password for user '%s'\n", p->url[p->current_url].user);
  +            apr_file_printf(local_stderr,
  +                            "missing password for user '%s'\n",
  +                            p->url[p->current_url].user);
               return APR_EGENERAL;
  -	} else {
  -	    credtls = apr_pstrcat(r->pool, p->url[p->current_url].user, ":", p->url[p->current_url].password,
NULL);
  -	    crdlen = strlen(credtls);
  -	    enc_credtls = (char *) apr_palloc(r->pool, apr_base64_encode_len(crdlen) + 1);
  -	    apr_base64_encode(enc_credtls, credtls, crdlen);
  -	    authz_hdr = apr_pstrcat(r->pool, "Authorization: Basic ", enc_credtls, CRLF, NULL);
  -	}
  +        } else {
  +            int credlen;
  +            credtls = apr_pstrcat(r->pool, p->url[p->current_url].user,
  +                                  ":", p->url[p->current_url].password, NULL);
  +            crdlen = strlen(credtls);
  +            enc_credtls = (char *) apr_palloc(r->pool,
  +                                              apr_base64_encode_len(crdlen) + 1);
  +            apr_base64_encode(enc_credtls, credtls, crdlen);
  +            authz_hdr = apr_pstrcat(r->pool, "Authorization: Basic ",
  +                                    enc_credtls, CRLF, NULL);
  +        }
       }
   
       switch (r->method)
  @@ -825,20 +830,26 @@
   
       apr_uri_parse(rp->pool, r->uri, r->parsed_uri);
       if (r->parsed_uri->scheme == NULL || r->parsed_uri->hostname == NULL) {
  -        apr_file_printf (local_stderr, "Misformed URL '%s'\n", r->uri);
  +        apr_file_printf(local_stderr, "Misformed URL '%s'\n", r->uri);
           exit (APR_EGENERAL);
  -    }                                                                          
  +    }
       if (r->parsed_uri->hostname[0] == '\0') {
  -        apr_file_printf (local_stderr, "Misformed URL '%s' -- can't find valid hostname.\n",
r->uri);
  +        apr_file_printf(local_stderr,
  +                        "Misformed URL '%s' -- can't find valid hostname.\n",
  +                        r->uri);
           exit (APR_EGENERAL);
       }
       /* this schouldn't be hardcoded, but... :) */
  -    if (apr_strnatcmp (r->parsed_uri->scheme, "http") != APR_SUCCESS && apr_strnatcmp
(r->parsed_uri->scheme, "https") != APR_SUCCESS) {
  -        apr_file_printf (local_stderr, "Wrong URL scheme '%s' -- only 'http' and 'https'
schemes are supported.\n", r->parsed_uri->scheme);
  +    if (apr_strnatcmp (r->parsed_uri->scheme, "http") != APR_SUCCESS
  +        && apr_strnatcmp (r->parsed_uri->scheme, "https") != APR_SUCCESS)
{
  +        apr_file_printf(local_stderr,
  +                        "Wrong URL scheme '%s' -- only 'http' and 'https' schemes are supported.\n",
  +                        r->parsed_uri->scheme);
           exit (APR_EGENERAL);
       }
       if (r->parsed_uri->user != NULL || r->parsed_uri->password != NULL) {
  -        apr_file_printf (local_stderr, "Misformed URL -- auth data schould be outside URL
-- please see docs.\n");
  +        apr_file_printf(local_stderr,
  +                        "Misformed URL -- auth data schould be outside URL -- please see
docs.\n");
           exit (APR_EGENERAL);
       }
       if (!r->parsed_uri->port)
  @@ -914,9 +925,11 @@
           status = regexec(&re, resp->rbuf, 10, match, 0);
   
           if (status != REG_OK) {
  -            apr_file_printf(local_stderr, "Regular expression match failed (%s)\n", rp->url[rp->current_url].responsetemplate);
  +            apr_file_printf(local_stderr,
  +                            "Regular expression match failed (%s)\n",
  +                            rp->url[rp->current_url].responsetemplate);
               return APR_EGENERAL;
  -	}
  +        }
   
           size = match[1].rm_eo - match[1].rm_so + 1;
           newValue = apr_palloc(rp->pool, size);
  
  
  

Mime
View raw message