Skip to content

zstd cannot match when accept-encoding is gzip,zstd,br #20

@drawing

Description

@drawing

cannot match zstd when accept-encoding is gzip,zstd,br.

static ngx_int_t
ngx_http_zstd_accept_encoding(ngx_str_t *ae)
{
    u_char  *p;

    p = ngx_strcasestrn(ae->data, "zstd", sizeof("zstd") - 1);
    if (p == NULL) {
        return NGX_DECLINED;
    }

    if (p == ae->data || (*(p - 1) == ',' || *(p - 1) == ' ')) {

        p += sizeof("zstd") - 1;

        if (p == ae->data + ae->len || *p == ',' || *p == ' ' || *p == ';') {
            return NGX_OK;
        }
    }

    return NGX_DECLINED;
}

u_char * ngx_strcasestrn(u_char *s1, char *s2, size_t n)

The argument n of ngx_strcasestrn must be length of the second substring - 1. But the length 4 is passed in the code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions