You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by co...@locus.apache.org on 2000/09/13 03:36:04 UTC

cvs commit: apache-2.0/src/main http_protocol.c

coar        00/09/12 18:36:03

  Modified:    src/main http_protocol.c
  Log:
  	Do a bunch of style-guide fixups (like wrapping Boolean tests
  	correctly and enblocking singel-statement if()s).
  
  Revision  Changes    Path
  1.122     +170 -119  apache-2.0/src/main/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_protocol.c,v
  retrieving revision 1.121
  retrieving revision 1.122
  diff -u -u -r1.121 -r1.122
  --- http_protocol.c	2000/09/12 03:40:15	1.121
  +++ http_protocol.c	2000/09/13 01:36:01	1.122
  @@ -176,34 +176,40 @@
    *    - then, if there are no parameters on type, add the default charset
    *    - return type
    */
  -static const char *make_content_type(request_rec *r, const char *type) {
  +static const char *make_content_type(request_rec *r, const char *type)
  +{
       static const char *needcset[] = {
   	"text/plain",
   	"text/html",
   	NULL };
       const char **pcset;
  -    core_dir_config *conf = (core_dir_config *)ap_get_module_config(
  -	r->per_dir_config, &core_module);
  +    core_dir_config *conf =
  +	(core_dir_config *)ap_get_module_config(r->per_dir_config,
  +						&core_module);
   
  -    if (!type)
  -        type = ap_default_type(r);
  -    if (conf->add_default_charset != ADD_DEFAULT_CHARSET_ON)
  -        return type;
  +    if (!type) {
  +	type = ap_default_type(r);
  +    }
  +    if (conf->add_default_charset != ADD_DEFAULT_CHARSET_ON) {
  +	return type;
  +    }
   
       if (ap_strcasestr(type, "charset=") != NULL) {
   	/* already has parameter, do nothing */
   	/* XXX we don't check the validity */
   	;
  -    } else {
  +    }
  +    else {
       	/* see if it makes sense to add the charset. At present,
   	 * we only add it if the Content-type is one of needcset[]
   	 */
  -	for (pcset = needcset; *pcset ; pcset++)
  +	for (pcset = needcset; *pcset ; pcset++) {
   	    if (ap_strcasestr(type, *pcset) != NULL) {
   		type = apr_pstrcat(r->pool, type, "; charset=", 
  -		    conf->add_default_charset_name, NULL);
  +				   conf->add_default_charset_name, NULL);
   		break;
   	    }
  +	}
       }
       return type;
   }
  @@ -359,7 +365,8 @@
                    */
                   (void) checked_bputstrs(r, CRLF "--", r->boundary, "--" CRLF,
                                           NULL);
  -            } else {
  +            }
  +	    else {
                   *tlength += 4 + strlen(r->boundary) + 4;
               }
           }
  @@ -457,28 +464,28 @@
        *
        * Note that the condition evaluation order is extremely important.
        */
  -    if ((r->connection->keepalive != -1) &&
  -        ((r->status == HTTP_NOT_MODIFIED) ||
  -         (r->status == HTTP_NO_CONTENT) ||
  -         r->header_only ||
  -         apr_table_get(r->headers_out, "Content-Length") ||
  -         ap_find_last_token(r->pool,
  -                         apr_table_get(r->headers_out, "Transfer-Encoding"),
  -                         "chunked") ||
  -         ((r->proto_num >= HTTP_VERSION(1,1)) &&
  -	  (r->chunked = 1))) && /* THIS CODE IS CORRECT, see comment above. */
  -        r->server->keep_alive &&
  -        (r->server->keep_alive_timeout > 0) &&
  -        ((r->server->keep_alive_max == 0) ||
  -         (r->server->keep_alive_max > r->connection->keepalives)) &&
  -        !ap_status_drops_connection(r->status) &&
  -        !wimpy &&
  -        !ap_find_token(r->pool, conn, "close") &&
  -        (!apr_table_get(r->subprocess_env, "nokeepalive") ||
  -         apr_table_get(r->headers_in, "Via")) &&
  -        ((ka_sent = ap_find_token(r->pool, conn, "keep-alive")) ||
  -         (r->proto_num >= HTTP_VERSION(1,1)))
  -       ) {
  +    if ((r->connection->keepalive != -1)
  +	&& ((r->status == HTTP_NOT_MODIFIED)
  +	    || (r->status == HTTP_NO_CONTENT)
  +	    || r->header_only
  +	    || apr_table_get(r->headers_out, "Content-Length")
  +	    || ap_find_last_token(r->pool,
  +				  apr_table_get(r->headers_out,
  +						"Transfer-Encoding"),
  +				  "chunked")
  +	    || ((r->proto_num >= HTTP_VERSION(1,1))
  +		&& (r->chunked = 1))) /* THIS CODE IS CORRECT, see comment above. */
  +        && r->server->keep_alive
  +	&& (r->server->keep_alive_timeout > 0)
  +	&& ((r->server->keep_alive_max == 0)
  +	    || (r->server->keep_alive_max > r->connection->keepalives))
  +	&& !ap_status_drops_connection(r->status)
  +	&& !wimpy
  +	&& !ap_find_token(r->pool, conn, "close")
  +	&& (!apr_table_get(r->subprocess_env, "nokeepalive")
  +	    || apr_table_get(r->headers_in, "Via"))
  +	&& ((ka_sent = ap_find_token(r->pool, conn, "keep-alive"))
  +	    || (r->proto_num >= HTTP_VERSION(1,1)))) {
           int left = r->server->keep_alive_max - r->connection->keepalives;
   
           r->connection->keepalive = 1;
  @@ -570,9 +577,9 @@
        *     respond with a status of 412 (Precondition Failed).
        */
       if ((if_match = apr_table_get(r->headers_in, "If-Match")) != NULL) {
  -        if (if_match[0] != '*' &&
  -            (etag == NULL || etag[0] == 'W' ||
  -             !ap_find_list_item(r->pool, if_match, etag))) {
  +        if (if_match[0] != '*'
  +	    && (etag == NULL || etag[0] == 'W'
  +		|| !ap_find_list_item(r->pool, if_match, etag))) {
               return HTTP_PRECONDITION_FAILED;
           }
       }
  @@ -607,12 +614,13 @@
       if_nonematch = apr_table_get(r->headers_in, "If-None-Match");
       if (if_nonematch != NULL) {
           if (r->method_number == M_GET) {
  -            if (if_nonematch[0] == '*')
  -                return HTTP_NOT_MODIFIED;
  +            if (if_nonematch[0] == '*') {
  +		return HTTP_NOT_MODIFIED;
  +	    }
               if (etag != NULL) {
                   if (apr_table_get(r->headers_in, "Range")) {
  -                    if (etag[0] != 'W' &&
  -                        ap_find_list_item(r->pool, if_nonematch, etag)) {
  +                    if (etag[0] != 'W'
  +			&& ap_find_list_item(r->pool, if_nonematch, etag)) {
                           return HTTP_NOT_MODIFIED;
                       }
                   }
  @@ -621,9 +629,9 @@
                   }
               }
           }
  -        else if (if_nonematch[0] == '*' ||
  -                 (etag != NULL &&
  -                  ap_find_list_item(r->pool, if_nonematch, etag))) {
  +        else if (if_nonematch[0] == '*'
  +		 || (etag != NULL
  +		     && ap_find_list_item(r->pool, if_nonematch, etag))) {
               return HTTP_PRECONDITION_FAILED;
           }
       }
  @@ -636,7 +644,8 @@
        */
       else if ((r->method_number == M_GET)
                && ((if_modified_since =
  -                  apr_table_get(r->headers_in, "If-Modified-Since")) != NULL)) {
  +                  apr_table_get(r->headers_in,
  +				"If-Modified-Since")) != NULL)) {
           apr_time_t ims = ap_parseHTTPdate(if_modified_since);
   
   	if ((ims >= mtime) && (ims <= r->request_time)) {
  @@ -671,18 +680,19 @@
        * would be incorrect.
        */
       
  -    weak = ((r->request_time - r->mtime > APR_USEC_PER_SEC) && !force_weak) ? "" : "W/";
  +    weak = ((r->request_time - r->mtime > APR_USEC_PER_SEC)
  +	    && !force_weak) ? "" : "W/";
   
       if (r->finfo.protection != 0) {
           etag = apr_psprintf(r->pool,
  -                    "%s\"%lx-%lx-%lx\"", weak,
  -                    (unsigned long) r->finfo.inode,
  -                    (unsigned long) r->finfo.size,
  -                    (unsigned long) r->mtime);
  +			    "%s\"%lx-%lx-%lx\"", weak,
  +			    (unsigned long) r->finfo.inode,
  +			    (unsigned long) r->finfo.size,
  +			    (unsigned long) r->mtime);
       }
       else {
           etag = apr_psprintf(r->pool, "%s\"%lx\"", weak,
  -                    (unsigned long) r->mtime);
  +			    (unsigned long) r->mtime);
       }
   
       return etag;
  @@ -815,7 +825,8 @@
    * Turn a known method number into a name.  Doesn't work for
    * extension methods, obviously.
    */
  -API_EXPORT(const char *) ap_method_name_of(int methnum) {
  +API_EXPORT(const char *) ap_method_name_of(int methnum)
  +{
       static const char *AP_HTTP_METHODS[METHODS] = { NULL };
   
       /*
  @@ -910,7 +921,8 @@
                * it much easier to check field values for exact matches, and
                * saves memory as well.  Terminate string at end of line.
                */
  -            while (pos > (s + 1) && (*(pos - 1) == ' ' || *(pos - 1) == '\t')) {
  +            while (pos > (s + 1) && (*(pos - 1) == ' '
  +				     || *(pos - 1) == '\t')) {
                   --pos;          /* trim extra trailing spaces or tabs      */
                   --total;        /* but not one at the beginning of line    */
                   ++n;
  @@ -919,16 +931,17 @@
               --total;
               ++n;
           }
  -        else
  -            break;       /* if not, input line exceeded buffer size */
  -
  +        else {
  +	    break;       /* if not, input line exceeded buffer size */
  +	}
           /* Continue appending if line folding is desired and
            * the last line was not empty and we have room in the buffer and
            * the next line begins with a continuation character.
            */
  -    } while (fold && (retval != 1) && (n > 1)
  -                  && (next = ap_blookc(in))
  -                  && ((next == ' ') || (next == '\t')));
  +    } while (fold
  +	     && (retval != 1) && (n > 1)
  +	     && (next = ap_blookc(in))
  +	     && ((next == ' ') || (next == '\t')));
   
   #ifdef APACHE_XLATE
       /* restore translation handle */
  @@ -952,7 +965,8 @@
   
       if (r->method_number == M_CONNECT) {
   	status = ap_parse_hostinfo_components(r->pool, uri, &r->parsed_uri);
  -    } else {
  +    }
  +    else {
   	/* Simple syntax Errors in URLs are trapped by parse_uri_components(). */
   	status = ap_parse_uri_components(r->pool, uri, &r->parsed_uri);
       }
  @@ -962,7 +976,8 @@
   	if (r->parsed_uri.scheme
   	    && !strcasecmp(r->parsed_uri.scheme, ap_http_method(r))) {
   	    r->hostname = r->parsed_uri.hostname;
  -	} else if (r->method_number == M_CONNECT) {
  +	}
  +	else if (r->method_number == M_CONNECT) {
   	    r->hostname = r->parsed_uri.hostname;
   	}
   	r->args = r->parsed_uri.query;
  @@ -1101,8 +1116,8 @@
               (++fields_read > r->server->limit_req_fields)) {
               r->status = HTTP_BAD_REQUEST;
               apr_table_setn(r->notes, "error-notes",
  -                          "The number of request header fields exceeds "
  -                          "this server's limit.<P>\n");
  +			   "The number of request header fields exceeds "
  +			   "this server's limit.<P>\n");
               return;
           }
           /* getline returns (size of max buffer - 1) if it fills up the
  @@ -1111,9 +1126,13 @@
            */
           if (len > r->server->limit_req_fieldsize) {
               r->status = HTTP_BAD_REQUEST;
  -            apr_table_setn(r->notes, "error-notes", apr_pstrcat(r->pool,
  -                "Size of a request header field exceeds server limit.<P>\n"
  -                "<PRE>\n", ap_escape_html(r->pool, field), "</PRE>\n", NULL));
  +            apr_table_setn(r->notes, "error-notes",
  +			   apr_pstrcat(r->pool,
  +				       "Size of a request header field "
  +				       "exceeds server limit.<P>\n"
  +				       "<PRE>\n",
  +				       ap_escape_html(r->pool, field),
  +				       "</PRE>\n", NULL));
               return;
           }
           copy = apr_palloc(r->pool, len + 1);
  @@ -1121,16 +1140,21 @@
   
           if (!(value = strchr(copy, ':'))) {     /* Find the colon separator */
               r->status = HTTP_BAD_REQUEST;       /* or abort the bad request */
  -            apr_table_setn(r->notes, "error-notes", apr_pstrcat(r->pool,
  -                "Request header field is missing colon separator.<P>\n"
  -                "<PRE>\n", ap_escape_html(r->pool, copy), "</PRE>\n", NULL));
  +            apr_table_setn(r->notes, "error-notes",
  +			   apr_pstrcat(r->pool,
  +				       "Request header field is missing "
  +				       "colon separator.<P>\n"
  +				       "<PRE>\n",
  +				       ap_escape_html(r->pool, copy),
  +				       "</PRE>\n", NULL));
               return;
           }
   
           *value = '\0';
           ++value;
  -        while (*value == ' ' || *value == '\t')
  +        while (*value == ' ' || *value == '\t') {
               ++value;            /* Skip to start of value   */
  +	}
   
   	apr_table_addn(tmp_headers, copy, value);
       }
  @@ -1188,7 +1212,7 @@
       if (!read_request_line(r)) {
           if (r->status == HTTP_REQUEST_URI_TOO_LARGE) {
               ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
  -                         "request failed: URI too long");
  +			  "request failed: URI too long");
               ap_send_error_response(r, 0);
               ap_run_log_transaction(r);
               return r;
  @@ -1197,13 +1221,13 @@
       }
       if (r->connection->keptalive) {
           ap_bsetopt(r->connection->client, BO_TIMEOUT,
  -            &r->server->timeout);
  +		   &r->server->timeout);
       }
       if (!r->assbackwards) {
           get_mime_headers(r);
           if (r->status != HTTP_REQUEST_TIME_OUT) {
               ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
  -                         "request failed: error reading the headers");
  +			  "request failed: error reading the headers");
               ap_send_error_response(r, 0);
               ap_run_log_transaction(r);
               return r;
  @@ -1390,7 +1414,7 @@
   
       if (!ap_auth_name(r)) {
           ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR,
  -		    0, r, "need AuthName: %s", r->uri);
  +		      0, r, "need AuthName: %s", r->uri);
           return HTTP_INTERNAL_SERVER_ERROR;
       }
   
  @@ -1402,13 +1426,14 @@
       if (strcasecmp(ap_getword(r->pool, &auth_line, ' '), "Basic")) {
           /* Client tried to authenticate using wrong auth scheme */
           ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
  -                    "client used wrong authentication scheme: %s", r->uri);
  +		      "client used wrong authentication scheme: %s", r->uri);
           ap_note_basic_auth_failure(r);
           return HTTP_UNAUTHORIZED;
       }
   
  -    while (*auth_line== ' ' || *auth_line== '\t')
  +    while (*auth_line== ' ' || *auth_line== '\t') {
           auth_line++;
  +    }
   
       t = ap_pbase64decode(r->pool, auth_line);
       /* Note that this allocation has to be made from r->connection->pool
  @@ -1519,10 +1544,12 @@
           status -= 100;
           if (status < 100) {
               pos = (status + shortcut[i]);
  -            if (pos < shortcut[i + 1])
  +            if (pos < shortcut[i + 1]) {
                   return pos;
  -            else
  +	    }
  +            else {
                   return LEVEL_500;       /* status unknown (falls in gap) */
  +	    }
           }
       }
       return LEVEL_500;           /* 600 or above is also illegal */
  @@ -1565,8 +1592,9 @@
           protocol = "HTTP/1.0";
           r->connection->keepalive = -1;
       }
  -    else
  +    else {
           protocol = AP_SERVER_PROTOCOL;
  +    }
   
   #ifdef APACHE_XLATE
       { AP_PUSH_OUTPUTCONVERSION_STATE(r->connection->client,
  @@ -1769,7 +1797,7 @@
               }
           }
           if (i == values->nelts) {  /* if not found */
  -           *(char **)apr_push_array(values) = start;
  +	    *(char **)apr_push_array(values) = start;
           }
       } while (*e != '\0');
   
  @@ -1798,7 +1826,7 @@
   
       if (varies->nelts > 0) {
   	apr_table_setn(r->headers_out, "Vary",
  -		      apr_array_pstrcat(r->pool, varies, ','));
  +		       apr_array_pstrcat(r->pool, varies, ','));
       }
   }
   
  @@ -1867,24 +1895,33 @@
           ap_add_filter("CHUNK", NULL, r);
       }
   
  -    if (r->byterange > 1)
  +    if (r->byterange > 1) {
           apr_table_setn(r->headers_out, "Content-Type",
  -                  apr_pstrcat(r->pool, "multipart", use_range_x(r) ? "/x-" : "/",
  -                          "byteranges; boundary=", r->boundary, NULL));
  -    else apr_table_setn(r->headers_out, "Content-Type", make_content_type(r, 
  -	r->content_type));
  +		       apr_pstrcat(r->pool, "multipart",
  +				   use_range_x(r) ? "/x-" : "/",
  +				   "byteranges; boundary=",
  +				   r->boundary, NULL));
  +    }
  +    else {
  +	apr_table_setn(r->headers_out, "Content-Type",
  +		       make_content_type(r, r->content_type));
  +    }
   
  -    if (r->content_encoding)
  -        apr_table_setn(r->headers_out, "Content-Encoding", r->content_encoding);
  +    if (r->content_encoding) {
  +        apr_table_setn(r->headers_out, "Content-Encoding",
  +		       r->content_encoding);
  +    }
   
       if (r->content_languages && r->content_languages->nelts) {
           for (i = 0; i < r->content_languages->nelts; ++i) {
               apr_table_mergen(r->headers_out, "Content-Language",
  -                        ((char **) (r->content_languages->elts))[i]);
  +			     ((char **) (r->content_languages->elts))[i]);
           }
       }
  -    else if (r->content_language)
  -        apr_table_setn(r->headers_out, "Content-Language", r->content_language);
  +    else if (r->content_language) {
  +        apr_table_setn(r->headers_out, "Content-Language",
  +		       r->content_language);
  +    }
   
       /*
        * Control cachability for non-cachable responses if not already set by
  @@ -1897,17 +1934,17 @@
       }
   
       apr_table_do((int (*) (void *, const char *, const char *)) ap_send_header_field,
  -             (void *) r, r->headers_out, NULL);
  +		 (void *) r, r->headers_out, NULL);
   
       terminate_header(r);
   
  -
       ap_bsetopt(r->connection->client, BO_BYTECT, &zero);
       r->sent_bodyct = 1;         /* Whatever follows is real body stuff... */
   
       /* Set buffer flags for the body */
  -    if (r->chunked)
  +    if (r->chunked) {
           ap_bsetflag(r->connection->client, B_CHUNK, 1);
  +    }
   #ifdef APACHE_XLATE
       AP_POP_OUTPUTCONVERSION_STATE(r->connection->client); }
   #endif /*APACHE_XLATE*/
  @@ -1978,12 +2015,12 @@
       if (tenc) {
           if (strcasecmp(tenc, "chunked")) {
               ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
  -                        "Unknown Transfer-Encoding %s", tenc);
  +			  "Unknown Transfer-Encoding %s", tenc);
               return HTTP_NOT_IMPLEMENTED;
           }
           if (r->read_body == REQUEST_CHUNKED_ERROR) {
               ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
  -                        "chunked Transfer-Encoding forbidden: %s", r->uri);
  +			  "chunked Transfer-Encoding forbidden: %s", r->uri);
               return (lenp) ? HTTP_BAD_REQUEST : HTTP_LENGTH_REQUIRED;
           }
   
  @@ -1992,11 +2029,12 @@
       else if (lenp) {
           const char *pos = lenp;
   
  -        while (apr_isdigit(*pos) || apr_isspace(*pos))
  +        while (apr_isdigit(*pos) || apr_isspace(*pos)) {
               ++pos;
  +	}
           if (*pos != '\0') {
               ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
  -                        "Invalid Content-Length %s", lenp);
  +			  "Invalid Content-Length %s", lenp);
               return HTTP_BAD_REQUEST;
           }
   
  @@ -2006,15 +2044,15 @@
       if ((r->read_body == REQUEST_NO_BODY) &&
           (r->read_chunked || (r->remaining > 0))) {
           ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
  -                    "%s with body is not allowed for %s", r->method, r->uri);
  +		      "%s with body is not allowed for %s", r->method, r->uri);
           return HTTP_REQUEST_ENTITY_TOO_LARGE;
       }
   
       max_body = ap_get_limit_req_body(r);
       if (max_body && (r->remaining > max_body)) {
           ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
  -          "Request content-length of %s is larger than the configured "
  -          "limit of %lu", lenp, max_body);
  +		      "Request content-length of %s is larger than "
  +		      "the configured limit of %lu", lenp, max_body);
           return HTTP_REQUEST_ENTITY_TOO_LARGE;
       }
   
  @@ -2067,12 +2105,15 @@
       while (apr_isxdigit(*b)) {
           int xvalue = 0;
   
  -        if (*b >= '0' && *b <= '9')
  +        if (*b >= '0' && *b <= '9') {
               xvalue = *b - '0';
  -        else if (*b >= 'A' && *b <= 'F')
  +	}
  +        else if (*b >= 'A' && *b <= 'F') {
               xvalue = *b - 'A' + 0xa;
  -        else if (*b >= 'a' && *b <= 'f')
  +	}
  +        else if (*b >= 'a' && *b <= 'f') {
               xvalue = *b - 'a' + 0xa;
  +	}
   
           chunksize = (chunksize << 4) | xvalue;
           ++b;
  @@ -2136,8 +2177,8 @@
       max_body = ap_get_limit_req_body(r);
       if (max_body && (r->read_length > max_body)) {
           ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
  -            "Chunked request body is larger than the configured limit of %lu",
  -            max_body);
  +		      "Chunked request body is larger than the "
  +		      "configured limit of %lu", max_body);
           r->connection->keepalive = -1;
           return -1;
       }
  @@ -2159,7 +2200,7 @@
                   apr_snprintf(buffer, bufsiz, "%ld", r->read_length);
                   apr_table_unset(r->headers_in, "Transfer-Encoding");
                   apr_table_setn(r->headers_in, "Content-Length",
  -                    apr_pstrdup(r->pool, buffer));
  +			       apr_pstrdup(r->pool, buffer));
                   return 0;
               }
               r->remaining = -1;  /* Indicate footers in-progress */
  @@ -2184,8 +2225,9 @@
       if (r->remaining == -1) {   /* reading footers until empty line  */
           len_read = chunk_start;
   
  -        while ((bufsiz > 1) && ((len_read =
  -                  getline(buffer, bufsiz, r->connection->client, 1)) > 0)) {
  +        while ((bufsiz > 1)
  +	       && ((len_read = getline(buffer, bufsiz, r->connection->client,
  +				       1)) > 0)) {
   
               if (len_read != (bufsiz - 1)) {
                   buffer[len_read++] = CR;        /* Restore footer line end  */
  @@ -2401,10 +2443,12 @@
       }
   
       while (!r->connection->aborted) {
  -        if ((length > 0) && (total_bytes_sent + IOBUFSIZE) > length)
  +        if ((length > 0) && (total_bytes_sent + IOBUFSIZE) > length) {
               n = length - total_bytes_sent;
  -        else
  +	}
  +        else {
               n = IOBUFSIZE;
  +	}
           
           do {
               rv = apr_read(fd, buf, &n);
  @@ -2416,8 +2460,9 @@
           }
   
           o = ap_rwrite(buf, n, r);
  -        if (o < 0)
  +        if (o < 0) {
               break;
  +	}
           total_bytes_sent += o;
       }
   
  @@ -2538,8 +2583,9 @@
       ap_bucket *b;
       char c2 = (char)c;
   
  -    if (r->connection->aborted)
  -        return EOF;
  +    if (r->connection->aborted) {
  +	return EOF;
  +    }
   
       bb = ap_brigade_create(r->pool);
       b = ap_bucket_create_transient(&c2, 1);
  @@ -2681,7 +2727,7 @@
       if (status == HTTP_NOT_MODIFIED) {
           if (!apr_is_empty_table(r->err_headers_out))
               r->headers_out = apr_overlay_tables(r->pool, r->err_headers_out,
  -                                               r->headers_out);
  +						r->headers_out);
           ap_basic_http_header(r);
           ap_set_keepalive(r);
   
  @@ -2844,7 +2890,8 @@
   	case HTTP_BAD_REQUEST:
   	    ap_rputs("Your browser sent a request that "
   	             "this server could not understand.<P>\n", r);
  -	    if ((error_notes = apr_table_get(r->notes, "error-notes")) != NULL) {
  +	    if ((error_notes = apr_table_get(r->notes, "error-notes"))
  +		!= NULL) {
   		ap_rvputs(r, error_notes, "<P>\n", NULL);
   	    }
   	    break;
  @@ -2881,7 +2928,8 @@
   	case HTTP_LENGTH_REQUIRED:
   	    ap_rvputs(r, "A request of the requested method ", r->method,
   		      " requires a valid Content-length.<P>\n", NULL);
  -	    if ((error_notes = apr_table_get(r->notes, "error-notes")) != NULL) {
  +	    if ((error_notes = apr_table_get(r->notes, "error-notes"))
  +		!= NULL) {
   		ap_rvputs(r, error_notes, "<P>\n", NULL);
   	    }
   	    break;
  @@ -2894,14 +2942,16 @@
   	    ap_rvputs(r, ap_escape_html(r->pool, r->method), " to ",
   		      ap_escape_html(r->pool, r->uri),
   		      " not supported.<P>\n", NULL);
  -	    if ((error_notes = apr_table_get(r->notes, "error-notes")) != NULL) {
  +	    if ((error_notes = apr_table_get(r->notes, "error-notes"))
  +		!= NULL) {
   		ap_rvputs(r, error_notes, "<P>\n", NULL);
   	    }
   	    break;
   	case HTTP_BAD_GATEWAY:
   	    ap_rputs("The proxy server received an invalid" CRLF
   	             "response from an upstream server.<P>" CRLF, r);
  -	    if ((error_notes = apr_table_get(r->notes, "error-notes")) != NULL) {
  +	    if ((error_notes = apr_table_get(r->notes, "error-notes"))
  +		!= NULL) {
   		ap_rvputs(r, error_notes, "<P>\n", NULL);
   	    }
   	    break;
  @@ -2932,7 +2982,8 @@
   	case HTTP_REQUEST_URI_TOO_LARGE:
   	    ap_rputs("The requested URL's length exceeds the capacity\n"
   	             "limit for this server.<P>\n", r);
  -	    if ((error_notes = apr_table_get(r->notes, "error-notes")) != NULL) {
  +	    if ((error_notes = apr_table_get(r->notes, "error-notes"))
  +		!= NULL) {
   		ap_rvputs(r, error_notes, "<P>\n", NULL);
   	    }
   	    break;
  
  
  

Re: cvs commit: apache-2.0/src/main http_protocol.c

Posted by Tony Finch <do...@dotat.at>.
Brian Havard <br...@kheldar.apana.org.au> wrote:
>
>>coar        00/09/12 18:36:03
>>
>>  	Do a bunch of style-guide fixups (like wrapping Boolean tests
>>  	correctly and enblocking singel-statement if()s).
>
>The style guide says no TAB characters, you just added a whole bunch.

The style guide is out of kilter with practice on this matter. The
source has included tabs all over the place for a long time.

Tony.
-- 
en oeccget g mtcaa    f.a.n.finch
v spdlkishrhtewe y    dot@dotat.at
eatp o v eiti i d.    fanf@covalent.net

Re: cvs commit: apache-2.0/src/main http_protocol.c

Posted by Jeff Trawick <tr...@bellsouth.net>.
Rodent of Unusual Size <Ke...@Golux.Com> writes:

> Not I, $$#%^% emacs.  Argh.  The changes I made were the visible
> ones; the invisible ones were done by the editor.

I didn't realize there was a package to get emacs to $$#%.

;;; Prevent Extraneous Tabs
(setq-default indent-tabs-mode nil)
-- 
Jeff Trawick | trawick@ibm.net | PGP public key at web site:
     http://www.geocities.com/SiliconValley/Park/9289/
          Born in Roswell... married an alien...

Re: cvs commit: apache-2.0/src/main http_protocol.c

Posted by Rodent of Unusual Size <Ke...@Golux.Com>.
Brian Havard wrote:
> 
> The style guide says no TAB characters, you just added a whole bunch.

Not I, $$#%^% emacs.  Argh.  The changes I made were the visible
ones; the invisible ones were done by the editor.
-- 
#ken    P-)}

Ken Coar                    <http://Golux.Com/coar/>
Apache Software Foundation  <http://www.apache.org/>
"Apache Server for Dummies" <http://Apache-Server.Com/>
"Apache Server Unleashed"   <http://ApacheUnleashed.Com/>

Re: cvs commit: apache-2.0/src/main http_protocol.c

Posted by Brian Havard <br...@kheldar.apana.org.au>.
On 13 Sep 2000 01:36:04 -0000, coar@locus.apache.org wrote:

>coar        00/09/12 18:36:03
>
>  Modified:    src/main http_protocol.c
>  Log:
>  	Do a bunch of style-guide fixups (like wrapping Boolean tests
>  	correctly and enblocking singel-statement if()s).

The style guide says no TAB characters, you just added a whole bunch.

-- 
 ______________________________________________________________________________
 |  Brian Havard                 |  "He is not the messiah!                   |
 |  brianh@kheldar.apana.org.au  |  He's a very naughty boy!" - Life of Brian |
 ------------------------------------------------------------------------------