nxt_http_static.c (2137:96f3ac16391b) nxt_http_static.c (2139:99d792169ffb)
1
2/*
3 * Copyright (C) NGINX, Inc.
4 */
5
6#include <nxt_router.h>
7#include <nxt_http.h>
8

--- 1010 unchanged lines hidden (view full) ---

1019typedef struct {
1020 nxt_str_t exten;
1021 nxt_str_t *type;
1022} nxt_http_static_mtype_t;
1023
1024
1025nxt_int_t
1026nxt_http_static_mtypes_hash_add(nxt_mp_t *mp, nxt_lvlhsh_t *hash,
1
2/*
3 * Copyright (C) NGINX, Inc.
4 */
5
6#include <nxt_router.h>
7#include <nxt_http.h>
8

--- 1010 unchanged lines hidden (view full) ---

1019typedef struct {
1020 nxt_str_t exten;
1021 nxt_str_t *type;
1022} nxt_http_static_mtype_t;
1023
1024
1025nxt_int_t
1026nxt_http_static_mtypes_hash_add(nxt_mp_t *mp, nxt_lvlhsh_t *hash,
1027 nxt_str_t *exten, nxt_str_t *type)
1027 const nxt_str_t *exten, nxt_str_t *type)
1028{
1029 nxt_lvlhsh_query_t lhq;
1030 nxt_http_static_mtype_t *mtype;
1031
1032 mtype = nxt_mp_get(mp, sizeof(nxt_http_static_mtype_t));
1033 if (nxt_slow_path(mtype == NULL)) {
1034 return NXT_ERROR;
1035 }

--- 8 unchanged lines hidden (view full) ---

1044 lhq.proto = &nxt_http_static_mtypes_hash_proto;
1045 lhq.pool = mp;
1046
1047 return nxt_lvlhsh_insert(hash, &lhq);
1048}
1049
1050
1051nxt_str_t *
1028{
1029 nxt_lvlhsh_query_t lhq;
1030 nxt_http_static_mtype_t *mtype;
1031
1032 mtype = nxt_mp_get(mp, sizeof(nxt_http_static_mtype_t));
1033 if (nxt_slow_path(mtype == NULL)) {
1034 return NXT_ERROR;
1035 }

--- 8 unchanged lines hidden (view full) ---

1044 lhq.proto = &nxt_http_static_mtypes_hash_proto;
1045 lhq.pool = mp;
1046
1047 return nxt_lvlhsh_insert(hash, &lhq);
1048}
1049
1050
1051nxt_str_t *
1052nxt_http_static_mtype_get(nxt_lvlhsh_t *hash, nxt_str_t *exten)
1052nxt_http_static_mtype_get(nxt_lvlhsh_t *hash, const nxt_str_t *exten)
1053{
1054 nxt_lvlhsh_query_t lhq;
1055 nxt_http_static_mtype_t *mtype;
1056
1057 static nxt_str_t empty = nxt_string("");
1058
1059 lhq.key = *exten;
1060 lhq.key_hash = nxt_djb_hash_lowcase(lhq.key.start, lhq.key.length);

--- 34 unchanged lines hidden ---
1053{
1054 nxt_lvlhsh_query_t lhq;
1055 nxt_http_static_mtype_t *mtype;
1056
1057 static nxt_str_t empty = nxt_string("");
1058
1059 lhq.key = *exten;
1060 lhq.key_hash = nxt_djb_hash_lowcase(lhq.key.start, lhq.key.length);

--- 34 unchanged lines hidden ---