httpd-test-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Erenkrantz <jerenkra...@apache.org>
Subject Re: cvs commit: httpd-test/flood config.h.in flood_round_robin.c
Date Fri, 06 Sep 2002 16:43:39 GMT
On Fri, Sep 06, 2002 at 10:16:10AM -0000, jacekp@apache.org wrote:
>   @@ -244,7 +247,9 @@
>    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;
>       
>        p = (round_robin_profile_t*)profile; 
>   @@ -271,6 +276,19 @@
>        else
>            cookies = "";
>    
>   +    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);
>   +            return APR_EGENERAL;
>   +	} else {

One nitpick is that lines shouldn't be over 80 characters.  So, the
apr_file_printf should be:
            apr_file_printf(local_stderr,
                            "missing password for user '%s'\n",
                            p->url[p->current_url].user);

We also don't use tabs.  Please remove them in favor of spaces.

You might want to take a quick glance at:

http://httpd.apache.org/dev/styleguide.html

>   +	    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);
>   +	}
>   +    }
>   +

Since crdlen isn't used outside of this else block, it seems that its
declaration should be inside the else block rather than at the
beginning of the function.  And, I'd guess it should be called
credlen - no need to mince one letter. 

Looks good though except for these minor nitpicks.  =)  -- justin

Mime
View raw message