From af067e17fb74cab32cce40b8be5fe153870ca35b Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sun, 10 May 2026 17:36:51 +0000 Subject: [PATCH] CLEANUP: tree-wide: fix typos in non user-visible comments in 15 files This fixes typos and spelling mistakes in the following files: channel-t.h channel.h filters-t.h http_htx.h htx-t.h tools.h cfgcond.c channel.c flt_http_comp.c http_ana.c htx.c mqtt.c mux_h1.c regex.c stats-proxy.c --- include/haproxy/channel-t.h | 52 ++++++++++++++++++++----------------- include/haproxy/channel.h | 6 ++--- include/haproxy/filters-t.h | 2 +- include/haproxy/http_htx.h | 2 +- include/haproxy/htx-t.h | 4 +-- include/haproxy/tools.h | 4 +-- src/cfgcond.c | 14 +++++----- src/channel.c | 6 ++--- src/flt_http_comp.c | 4 +-- src/http_ana.c | 2 +- src/htx.c | 4 +-- src/mqtt.c | 2 +- src/mux_h1.c | 4 +-- src/regex.c | 6 ++--- src/stats-proxy.c | 2 +- 15 files changed, 59 insertions(+), 55 deletions(-) diff --git a/include/haproxy/channel-t.h b/include/haproxy/channel-t.h index a2a11a561..cddfab82f 100644 --- a/include/haproxy/channel-t.h +++ b/include/haproxy/channel-t.h @@ -76,7 +76,7 @@ #define CF_WAKE_ONCE 0x10000000 /* pretend there is activity on this channel (one-shoot) */ #define CF_FLT_ANALYZE 0x20000000 /* at least one filter is still analyzing this channel */ -/* unuse 0x40000000 */ +/* unused 0x40000000 */ #define CF_ISRESP 0x80000000 /* 0 = request channel, 1 = response channel */ /* Masks which define input events for stream analysers */ @@ -252,27 +252,30 @@ struct channel { * without waking the parent up. The special value CHN_INFINITE_FORWARD is * never decreased nor increased. * - * The buf->o parameter says how many bytes may be consumed from the visible - * buffer. This parameter is updated by any buffer_write() as well as any data - * forwarded through the visible buffer. Since the ->to_forward attribute - * applies to data after buf->p, an analyser will not see a buffer which has a - * non-null ->to_forward with buf->i > 0. A producer is responsible for raising - * buf->o by min(to_forward, buf->i) when it injects data into the buffer. + * The channel's consumed data count (b_data(chn->buf)) says how many bytes may + * be consumed from the visible buffer. This is updated by any buffer_write() + * as well as any data forwarded through the visible buffer. Since the + * ->to_forward attribute applies to data beyond what's already been accounted + * for, an analyser will not see a buffer which has a non-null ->to_forward + * with additional unprocessed data. A producer is responsible for raising the + * consumed count by min(to_forward, available_data) when it injects data into + * the buffer. * - * The consumer is responsible for decreasing ->buf->o when it sends data - * from the visible buffer, and ->pipe->data when it sends data from the - * invisible buffer. + * The consumer is responsible for advancing the consumed count (via + * b_ack()) when it sends data from the visible buffer, and for updating + * ->pipe->data when it sends data from the invisible buffer. * * A real-world example consists in part in an HTTP response waiting in a * buffer to be forwarded. We know the header length (300) and the amount of * data to forward (content-length=9000). The buffer already contains 1000 * bytes of data after the 300 bytes of headers. Thus the caller will set - * buf->o to 300 indicating that it explicitly wants to send those data, and - * set ->to_forward to 9000 (content-length). This value must be normalised - * immediately after updating ->to_forward : since there are already 1300 bytes - * in the buffer, 300 of which are already counted in buf->o, and that size - * is smaller than ->to_forward, we must update buf->o to 1300 to flush the - * whole buffer, and reduce ->to_forward to 8000. After that, the producer may + * the consumed count to 300 indicating that it explicitly wants to send those + * data, and set ->to_forward to 9000 (content-length). This value must be + * normalised immediately after updating ->to_forward : since there are already + * 1300 bytes in the buffer, 300 of which are already counted in the consumed + * count, and that size is smaller than ->to_forward, we must update the + * consumed count to 1300 to flush the whole buffer, and reduce ->to_forward to + * 8000. After that, the producer may * try to feed the additional data through the invisible buffer using a * platform-specific method such as splice(). * @@ -291,15 +294,16 @@ struct channel { * buf->size - global.maxrewrite + ->to_forward. * * A buffer may contain up to 5 areas : - * - the data waiting to be sent. These data are located between buf->p-o and - * buf->p ; - * - the data to process and possibly transform. These data start at - * buf->p and may be up to ->i bytes long. - * - the data to preserve. They start at ->p and stop at ->p+i. The limit - * between the two solely depends on the protocol being analysed. + * - the data already consumed (acknowledged). These data are located between + * b_lim(b) and b_head(b) ; + * - the data available to process and possibly transform. These data start at + * b_head(b) and may be up to b_data(b) bytes long. + * - the data to preserve. They start at b_head(b) and stop at + * b_lim(b) + b_data(b). The limit between the two solely depends on the + * protocol being analysed. * - the spare area : it is the remainder of the buffer, which can be used to - * store new incoming data. It starts at ->p+i and is up to ->size-i-o long. - * It may be limited by global.maxrewrite. + * store new incoming data. It starts at b_lim(b) + b_data(b) and is up to + * b->size - b_data(b) long. It may be limited by global.maxrewrite. * - the reserved area : this is the area which must not be filled and is * reserved for possible rewrites ; it is up to global.maxrewrite bytes * long. diff --git a/include/haproxy/channel.h b/include/haproxy/channel.h index 6b8e793dc..6dfb6c80e 100644 --- a/include/haproxy/channel.h +++ b/include/haproxy/channel.h @@ -808,7 +808,7 @@ static inline size_t channel_data(const struct channel *chn) return (IS_HTX_STRM(chn_strm(chn)) ? htx_used_space(htxbuf(&chn->buf)) : c_data(chn)); } -/* Returns the amount of input data in a channel, taking he HTX streams into +/* Returns the amount of input data in a channel, taking the HTX streams into * account. This function relies on channel_data(). */ static inline size_t channel_input_data(const struct channel *chn) @@ -816,7 +816,7 @@ static inline size_t channel_input_data(const struct channel *chn) return channel_data(chn) - co_data(chn); } -/* Returns 1 if the channel is empty, taking he HTX streams into account */ +/* Returns 1 if the channel is empty, taking the HTX streams into account */ static inline size_t channel_empty(const struct channel *chn) { return (IS_HTX_STRM(chn) ? htx_is_empty(htxbuf(&chn->buf)) : c_empty(chn)); @@ -861,7 +861,7 @@ static inline void channel_check_xfer(struct channel *chn, size_t xferred) chn->flags &= ~(CF_STREAMER | CF_STREAMER_FAST); } else if (chn->xfer_small >= 2) { - /* if the buffer has been at least half full twchne, + /* if the buffer has been at least half full times, * we receive faster than we send, so at least it * is not a "fast streamer". */ diff --git a/include/haproxy/filters-t.h b/include/haproxy/filters-t.h index f2d804750..19e20fc3d 100644 --- a/include/haproxy/filters-t.h +++ b/include/haproxy/filters-t.h @@ -1,5 +1,5 @@ /* - * include/haproxy/filteers-t.h + * include/haproxy/filters-t.h * This file defines everything related to stream filters. * * Copyright (C) 2015 Qualys Inc., Christopher Faulet diff --git a/include/haproxy/http_htx.h b/include/haproxy/http_htx.h index 6a5b91e1a..ddd210ae2 100644 --- a/include/haproxy/http_htx.h +++ b/include/haproxy/http_htx.h @@ -1,5 +1,5 @@ /* - * include/haproxy/http_htx-t.h + * include/haproxy/http_htx.h * This file defines function prototypes for HTTP manipulation using the * internal representation. * diff --git a/include/haproxy/htx-t.h b/include/haproxy/htx-t.h index 3d4ecb7fe..2b53e03d8 100644 --- a/include/haproxy/htx-t.h +++ b/include/haproxy/htx-t.h @@ -128,7 +128,7 @@ */ #define HTX_SL_F_NONE 0x00000000 #define HTX_SL_F_IS_RESP 0x00000001 /* It is the response start-line (unset means the request one) */ -#define HTX_SL_F_XFER_LEN 0x00000002 /* The message xfer size can be dertermined */ +#define HTX_SL_F_XFER_LEN 0x00000002 /* The message xfer size can be determined */ #define HTX_SL_F_XFER_ENC 0x00000004 /* The transfer-encoding header was found in message */ #define HTX_SL_F_CLEN 0x00000008 /* The content-length header was found in message */ #define HTX_SL_F_CHNK 0x00000010 /* The message payload is chunked */ @@ -140,7 +140,7 @@ #define HTX_SL_F_HAS_AUTHORITY 0x00000400 /* The request authority is explicitly specified */ #define HTX_SL_F_NORMALIZED_URI 0x00000800 /* The received URI is normalized (an implicit absolute-uri form) */ #define HTX_SL_F_CONN_UPG 0x00001000 /* The message contains "connection: upgrade" header */ -#define HTX_SL_F_BODYLESS_RESP 0x00002000 /* The response to this message is bodyloess (only for reqyest) */ +#define HTX_SL_F_BODYLESS_RESP 0x00002000 /* The response to this message is bodyloess (only for request) */ #define HTX_SL_F_NOT_HTTP 0x00004000 /* Not an HTTP message (e.g "RTSP", only possible if invalid message are accepted) */ /* This function is used to report flags in debugging tools. Please reflect diff --git a/include/haproxy/tools.h b/include/haproxy/tools.h index 067d515c9..883bba597 100644 --- a/include/haproxy/tools.h +++ b/include/haproxy/tools.h @@ -826,7 +826,7 @@ static inline int get_addr_len(const struct sockaddr_storage *addr) return 0; } -/* set port in host byte order */ +/* set port in network byte order (use htons() before calling) */ static inline int set_net_port(struct sockaddr_storage *addr, int port) { switch (addr->ss_family) { @@ -840,7 +840,7 @@ static inline int set_net_port(struct sockaddr_storage *addr, int port) return 0; } -/* set port in network byte order */ +/* set port in host byte order */ static inline int set_host_port(struct sockaddr_storage *addr, int port) { switch (addr->ss_family) { diff --git a/src/cfgcond.c b/src/cfgcond.c index 491c1c877..58659a49f 100644 --- a/src/cfgcond.c +++ b/src/cfgcond.c @@ -77,7 +77,7 @@ void cfg_free_cond_term(struct cfg_cond_term *term) * cfg_free_cond_term(). An error will be set in on error, and only * in this case. In this case the first bad character will be reported in * . corresponds to the maximum recursion depth permitted, - * it is decremented on each recursive call and the parsing will fail one + * it is decremented on each recursive call and the parsing will fail upon * reaching <= 0. */ int cfg_parse_cond_term(const char **text, struct cfg_cond_term **term, char **err, const char **errptr, int maxdepth) @@ -370,11 +370,11 @@ void cfg_free_cond_expr(struct cfg_cond_expr *expr) * success. is filled with the parsed info, and is updated on * success to point to the first unparsed character, or is left untouched * on failure. On success, the caller will have to free all lower-level - * allocated structs using cfg_free_cond_expr(). An error will be set in + * allocated structs using cfg_free_cond_and(). An error will be set in * on error, and only in this case. In this case the first bad * character will be reported in . corresponds to the * maximum recursion depth permitted, it is decremented on each recursive - * call and the parsing will fail one reaching <= 0. + * call and the parsing will fail upon reaching <= 0. */ int cfg_parse_cond_and(const char **text, struct cfg_cond_and **expr, char **err, const char **errptr, int maxdepth) { @@ -438,7 +438,7 @@ int cfg_parse_cond_and(const char **text, struct cfg_cond_and **expr, char **err return ret; } -/* Parse an indirect input text as a possible config condition term. +/* Parse an indirect input text as a possible config condition expression. * Returns <0 on parsing error, 0 if the parser is desynchronized, or >0 on * success. is filled with the parsed info, and is updated on * success to point to the first unparsed character, or is left untouched @@ -447,7 +447,7 @@ int cfg_parse_cond_and(const char **text, struct cfg_cond_and **expr, char **err * on error, and only in this case. In this case the first bad * character will be reported in . corresponds to the * maximum recursion depth permitted, it is decremented on each recursive call - * and the parsing will fail one reaching <= 0. + * and the parsing will fail upon reaching <= 0. */ int cfg_parse_cond_expr(const char **text, struct cfg_cond_expr **expr, char **err, const char **errptr, int maxdepth) { @@ -511,7 +511,7 @@ int cfg_parse_cond_expr(const char **text, struct cfg_cond_expr **expr, char **e return ret; } -/* evaluate an sub-expression on a .if/.elif line. The expression is valid and +/* evaluate a sub-expression on a .if/.elif line. The expression is valid and * was already parsed in . Returns -1 on error (in which case err is * filled with a message, and only in this case), 0 if the condition is false, * 1 if it's true. @@ -544,7 +544,7 @@ int cfg_eval_cond_expr(struct cfg_cond_expr *expr, char **err) } /* evaluate a condition on a .if/.elif line. The condition is already tokenized - * in . Returns -1 on error (in which case err is filled with a message, + * in . Returns -1 on error (in which case err is filled with a message, * and only in this case), 0 if the condition is false, 1 if it's true. If * is not NULL, it's set to the first invalid character on error. */ diff --git a/src/channel.c b/src/channel.c index 972aad942..b4ac93ba7 100644 --- a/src/channel.c +++ b/src/channel.c @@ -54,7 +54,7 @@ unsigned long long __channel_forward(struct channel *chn, unsigned long long byt if (!budget) return forwarded; - /* Now we must ensure chn->to_forward sats below CHN_INFINITE_FORWARD, + /* Now we must ensure chn->to_forward stays below CHN_INFINITE_FORWARD, * which also implies it won't overflow. It's less operations in 64-bit. */ bytes = (unsigned long long)chn->to_forward + budget; @@ -105,7 +105,7 @@ int co_inject(struct channel *chn, const char *msg, int len) * controls. The chn->o and to_forward pointers are updated. If the channel * input is closed, -2 is returned. If there is not enough room left in the * buffer, -1 is returned. Otherwise the number of bytes copied is returned - * (1). Channel flag READ_PARTIAL is updated if some data can be transferred. + * (1). Channel flag CF_READ_EVENT is set if some data can be transferred. */ int ci_putchr(struct channel *chn, char c) { @@ -134,7 +134,7 @@ int ci_putchr(struct channel *chn, char c) * input is closed, -2 is returned. If the block is too large for this buffer, * -3 is returned. If there is not enough room left in the buffer, -1 is * returned. Otherwise the number of bytes copied is returned (0 being a valid - * number). Channel flag READ_PARTIAL is updated if some data can be + * number). Channel flag CF_READ_EVENT is set if some data can be * transferred. */ int ci_putblk(struct channel *chn, const char *blk, int len) diff --git a/src/flt_http_comp.c b/src/flt_http_comp.c index 8de0305a0..9e640f477 100644 --- a/src/flt_http_comp.c +++ b/src/flt_http_comp.c @@ -767,8 +767,8 @@ static int htx_compression_buffer_init(struct htx *htx, struct buffer *out) { /* output stream requires at least 10 bytes for the gzip header, plus - * at least 8 bytes for the gzip trailer (crc+len), plus a possible - * plus at most 5 bytes per 32kB block and 2 bytes to close the stream. + * at least 8 bytes for the gzip trailer (crc+len), plus at most + * 5 bytes per 32kB block and 2 bytes to close the stream. */ if (htx_free_space(htx) < 20 + 5 * ((htx->data + 32767) >> 15)) return -1; diff --git a/src/http_ana.c b/src/http_ana.c index b49967cbd..fbe529866 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -4827,7 +4827,7 @@ struct http_reply *http_error_message(struct stream *s) } /* Produces an HTX message from an http reply. Depending on the http reply type, - * a, errorfile, an raw file or a log-format string is used. On success, it + * an errorfile, a raw file or a log-format string is used. On success, it * returns 0. If an error occurs -1 is returned. If it fails, this function only * exits. It is the caller responsibility to do the cleanup. */ diff --git a/src/htx.c b/src/htx.c index 3584f9ffb..aedf7a483 100644 --- a/src/htx.c +++ b/src/htx.c @@ -167,7 +167,7 @@ static struct htx_blk *htx_reserve_nxblk(struct htx *htx, uint32_t blksz) /* Find the block's position. First, we try to get the next position in * the message, increasing the tail by one. If this position is not * available with some holes, we try to defrag the blocks without - * touching their paylood. If it is impossible, we fully defrag the + * touching their payload. If it is impossible, we fully defrag the * message. */ tail = htx->tail + 1; @@ -1358,7 +1358,7 @@ struct buffer *__htx_xfer_to_small_buffer(struct buffer *dst, struct buffer *src } /* If possible, transfer HTX blocks from to a large buffer. This function - * allocate the small buffer and makes point on it. If is not empty + * allocates the large buffer and makes point on it. If is not empty * or if contains to many data, NULL is returned. If the allocation * failed, NULL is returned. Otherwise is returned. instructs how * the transfer must be performed. diff --git a/src/mqtt.c b/src/mqtt.c index 7abbbbf0c..8e2f04a7e 100644 --- a/src/mqtt.c +++ b/src/mqtt.c @@ -144,7 +144,7 @@ const uint64_t mqtt_fields_per_packet[MQTT_CPT_ENTRIES] = { }; /* Checks the first byte of a message to read the fixed header and extract the - * packet type and flags. is supposed to point to the fix header byte. + * packet type and flags. is supposed to point to the fixed header byte. * * Fix header looks like: * +-------+-----------+-----------+-----------+---------+----------+----------+---------+------------+ diff --git a/src/mux_h1.c b/src/mux_h1.c index 4a367210b..f11543496 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -1670,7 +1670,7 @@ static void h1_update_req_conn_value(struct h1s *h1s, struct h1m *h1m, struct is { struct proxy *px = h1s->h1c->px; - /* Don't update "Connection:" header in TUNNEL mode or if "Upgrage" + /* Don't update "Connection:" header in TUNNEL mode or if "Upgrade" * token is found */ if (h1s->flags & H1S_F_WANT_TUN || h1m->flags & H1_MF_CONN_UPG) @@ -1692,7 +1692,7 @@ static void h1_update_req_conn_value(struct h1s *h1s, struct h1m *h1m, struct is static void h1_update_res_conn_value(struct h1s *h1s, struct h1m *h1m, struct ist *conn_val) { - /* Don't update "Connection:" header in TUNNEL mode or if "Upgrage" + /* Don't update "Connection:" header in TUNNEL mode or if "Upgrade" * token is found */ if (h1s->flags & H1S_F_WANT_TUN || h1m->flags & H1_MF_CONN_UPG) diff --git a/src/regex.c b/src/regex.c index cb2194fb8..c9d5258c4 100644 --- a/src/regex.c +++ b/src/regex.c @@ -196,7 +196,7 @@ int regex_exec_match(const struct my_regex *preg, const char *subject, pmatch[i].rm_eo = matches[(i*2)+1]; continue; } - /* Set the unmatvh flag (-1). */ + /* Set the unmatched flag (-1). */ pmatch[i].rm_so = -1; pmatch[i].rm_eo = -1; } @@ -212,7 +212,7 @@ int regex_exec_match(const struct my_regex *preg, const char *subject, #endif } -/* This function apply regex. It take a "char *" ans length as input. The +/* This function applies a regex. It takes a "char *" and length as input. The * can be modified during the processing. If the function doesn't * match, it returns false, else it returns true. * When it is compiled with standard POSIX regex or PCRE, this function add @@ -280,7 +280,7 @@ int regex_exec_match2(const struct my_regex *preg, char *subject, int length, pmatch[i].rm_eo = matches[(i*2)+1]; continue; } - /* Set the unmatvh flag (-1). */ + /* Set the unmatched flag (-1). */ pmatch[i].rm_so = -1; pmatch[i].rm_eo = -1; } diff --git a/src/stats-proxy.c b/src/stats-proxy.c index 5b6a70628..a4eda63f6 100644 --- a/src/stats-proxy.c +++ b/src/stats-proxy.c @@ -827,7 +827,7 @@ int stats_fill_sv_line(struct proxy *px, struct server *sv, int flags, stats_fill_sv_computestate(sv, ref, &state); } - /* compue time values for later use */ + /* compute time values for later use */ if (index == NULL || *index == ST_I_PX_QTIME || *index == ST_I_PX_CTIME || *index == ST_I_PX_RTIME || *index == ST_I_PX_TTIME) { -- 2.47.3