Skip to content

Commit

Permalink
Fixes after review by rpluem
Browse files Browse the repository at this point in the history
- re-add ap_mmn comment for 128 minor version
- reverted most changes of apr_strnatcasecmp() to ap_cstr_casecmp()
  since the former has special whitespace handling which *may* mattter
  in certain cases
- fixed log message when wrong Sec-WebSocket-Accept response
  header was found
  • Loading branch information
icing committed Aug 23, 2023
1 parent 6e3352e commit ea6cb0c
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions include/ap_mmn.h
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,7 @@
* 20120211.125 (2.4.55-dev) Export mod_http2.h as public header
* 20120211.126 (2.4.55-dev) Add additional hcmethod_t enums and PROXY_WORKER_IS_ERROR
* 20120211.127 (2.4.56-dev) Add ap_proxy_canonenc_ex
* 20120211.128 (2.4.55-dev) Add AP_CTIME_OPTION_GMTOFF to util_time.h
* 20120211.129 (2.4.58-dev) Add ap_get_pollfd_from_conn()
*/

Expand Down
4 changes: 2 additions & 2 deletions modules/http2/h2_c2_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ static int uniq_field_values(void *d, const char *key, const char *val)
*/
for (i = 0, strpp = (char **) values->elts; i < values->nelts;
++i, ++strpp) {
if (*strpp && ap_cstr_casecmp(*strpp, start) == 0) {
if (*strpp && apr_strnatcasecmp(*strpp, start) == 0) {
break;
}
}
Expand Down Expand Up @@ -312,7 +312,7 @@ static h2_headers *create_response(request_rec *r)

while (field && (token = ap_get_list_item(r->pool, &field)) != NULL) {
for (i = 0; i < r->content_languages->nelts; ++i) {
if (!ap_cstr_casecmp(token, languages[i]))
if (!apr_strnatcasecmp(token, languages[i]))
break;
}
if (i == r->content_languages->nelts) {
Expand Down
6 changes: 3 additions & 3 deletions modules/http2/h2_proxy_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ static int iq_bubble_down(h2_proxy_iqueue *q, int i, int bottom,
* h2_proxy_ngheader
******************************************************************************/
#define H2_HD_MATCH_LIT_CS(l, name) \
((strlen(name) == sizeof(l) - 1) && !ap_cstr_casecmp(l, name))
((strlen(name) == sizeof(l) - 1) && !apr_strnatcasecmp(l, name))

static int h2_util_ignore_header(const char *name)
{
Expand Down Expand Up @@ -500,7 +500,7 @@ static int ignore_header(const literal *lits, size_t llen,

for (i = 0; i < llen; ++i) {
lit = &lits[i];
if (lit->len == nlen && !ap_cstr_casecmp(lit->name, name)) {
if (lit->len == nlen && !apr_strnatcasecmp(lit->name, name)) {
return 1;
}
}
Expand Down Expand Up @@ -542,7 +542,7 @@ void h2_proxy_util_camel_case_header(char *s, size_t len)

/** Match a header value against a string constance, case insensitive */
#define H2_HD_MATCH_LIT(l, name, nlen) \
((nlen == sizeof(l) - 1) && !ap_cstr_casecmp(l, name))
((nlen == sizeof(l) - 1) && !apr_strnatcasecmp(l, name))

static apr_status_t h2_headers_add_h1(apr_table_t *headers, apr_pool_t *pool,
const char *name, size_t nlen,
Expand Down
2 changes: 1 addition & 1 deletion modules/http2/h2_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ apr_size_t h2_util_table_bytes(apr_table_t *t, apr_size_t pair_extra);

/** Match a header value against a string constance, case insensitive */
#define H2_HD_MATCH_LIT(l, name, nlen) \
((nlen == sizeof(l) - 1) && !ap_cstr_casecmp(l, name))
((nlen == sizeof(l) - 1) && !apr_strnatcasecmp(l, name))

/*******************************************************************************
* HTTP/2 header helpers
Expand Down
2 changes: 1 addition & 1 deletion modules/http2/h2_ws.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ static void ws_handle_resp(conn_rec *c2, h2_conn_ctx_t *conn_ctx,
* or in the request processings implementation of WebSockets */
ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, c2, APLOGNO(10463)
"h2_c2(%s-%d): websocket CONNECT, 101 response "
"without 'Sec-WebSocket-Accept: %s' but expected %s",
"with 'Sec-WebSocket-Accept: %s' but expected %s",
conn_ctx->id, conn_ctx->stream_id, hd,
ws_ctx->ws_accept_base64);
}
Expand Down
2 changes: 1 addition & 1 deletion modules/http2/h2_ws.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* Rewrite a websocket request.
*
* @param req the h2 request to rewrite
* @param conn the connection to process the request on
* @param c2 the connection to process the request on
* @param no_body != 0 iff the request is known to have no body
* @return the websocket request for internal submit
*/
Expand Down

0 comments on commit ea6cb0c

Please sign in to comment.