Changed nxt_memcasecmp() interface to avoid casts.
This commit is contained in:
@@ -655,8 +655,7 @@ nxt_h1p_header_buffer_test(nxt_task_t *task, nxt_h1proto_t *h1p, nxt_conn_t *c,
|
|||||||
static nxt_int_t
|
static nxt_int_t
|
||||||
nxt_h1p_connection(void *ctx, nxt_http_field_t *field, uintptr_t data)
|
nxt_h1p_connection(void *ctx, nxt_http_field_t *field, uintptr_t data)
|
||||||
{
|
{
|
||||||
nxt_http_request_t *r;
|
nxt_http_request_t *r;
|
||||||
static const u_char *upgrade = (const u_char *) "upgrade";
|
|
||||||
|
|
||||||
r = ctx;
|
r = ctx;
|
||||||
|
|
||||||
@@ -664,7 +663,7 @@ nxt_h1p_connection(void *ctx, nxt_http_field_t *field, uintptr_t data)
|
|||||||
r->proto.h1->keepalive = 0;
|
r->proto.h1->keepalive = 0;
|
||||||
|
|
||||||
} else if (field->value_length == 7
|
} else if (field->value_length == 7
|
||||||
&& nxt_memcasecmp(field->value, upgrade, 7) == 0)
|
&& nxt_memcasecmp(field->value, "upgrade", 7) == 0)
|
||||||
{
|
{
|
||||||
r->proto.h1->connection_upgrade = 1;
|
r->proto.h1->connection_upgrade = 1;
|
||||||
}
|
}
|
||||||
@@ -676,13 +675,12 @@ nxt_h1p_connection(void *ctx, nxt_http_field_t *field, uintptr_t data)
|
|||||||
static nxt_int_t
|
static nxt_int_t
|
||||||
nxt_h1p_upgrade(void *ctx, nxt_http_field_t *field, uintptr_t data)
|
nxt_h1p_upgrade(void *ctx, nxt_http_field_t *field, uintptr_t data)
|
||||||
{
|
{
|
||||||
nxt_http_request_t *r;
|
nxt_http_request_t *r;
|
||||||
static const u_char *websocket = (const u_char *) "websocket";
|
|
||||||
|
|
||||||
r = ctx;
|
r = ctx;
|
||||||
|
|
||||||
if (field->value_length == 9
|
if (field->value_length == 9
|
||||||
&& nxt_memcasecmp(field->value, websocket, 9) == 0)
|
&& nxt_memcasecmp(field->value, "websocket", 9) == 0)
|
||||||
{
|
{
|
||||||
r->proto.h1->upgrade_websocket = 1;
|
r->proto.h1->upgrade_websocket = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -188,10 +188,14 @@ nxt_strncasecmp(const u_char *s1, const u_char *s2, size_t length)
|
|||||||
|
|
||||||
|
|
||||||
nxt_int_t
|
nxt_int_t
|
||||||
nxt_memcasecmp(const u_char *s1, const u_char *s2, size_t length)
|
nxt_memcasecmp(const void *p1, const void *p2, size_t length)
|
||||||
{
|
{
|
||||||
u_char c1, c2;
|
u_char c1, c2;
|
||||||
nxt_int_t n;
|
nxt_int_t n;
|
||||||
|
const u_char *s1, *s2;
|
||||||
|
|
||||||
|
s1 = p1;
|
||||||
|
s2 = p2;
|
||||||
|
|
||||||
while (length-- != 0) {
|
while (length-- != 0) {
|
||||||
c1 = *s1++;
|
c1 = *s1++;
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ NXT_EXPORT u_char *nxt_cpystrn(u_char *dst, const u_char *src, size_t length);
|
|||||||
NXT_EXPORT nxt_int_t nxt_strcasecmp(const u_char *s1, const u_char *s2);
|
NXT_EXPORT nxt_int_t nxt_strcasecmp(const u_char *s1, const u_char *s2);
|
||||||
NXT_EXPORT nxt_int_t nxt_strncasecmp(const u_char *s1, const u_char *s2,
|
NXT_EXPORT nxt_int_t nxt_strncasecmp(const u_char *s1, const u_char *s2,
|
||||||
size_t length);
|
size_t length);
|
||||||
NXT_EXPORT nxt_int_t nxt_memcasecmp(const u_char *s1, const u_char *s2,
|
NXT_EXPORT nxt_int_t nxt_memcasecmp(const void *p1, const void *p2,
|
||||||
size_t length);
|
size_t length);
|
||||||
|
|
||||||
NXT_EXPORT u_char *nxt_memstrn(const u_char *s, const u_char *end,
|
NXT_EXPORT u_char *nxt_memstrn(const u_char *s, const u_char *end,
|
||||||
|
|||||||
Reference in New Issue
Block a user