Skip to content

Commit

Permalink
perf: improve search plugin
Browse files Browse the repository at this point in the history
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
  • Loading branch information
zhaojh329 committed Aug 20, 2021
1 parent c8bcc63 commit 21bd2ca
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ static int on_headers_complete(struct http_parser *parser)

/* match plugin */
while (p) {
if (strlen(p->h->path) == path.len && !strncmp(path.p, p->h->path, path.len)) {
if (p->len == path.len && !strncmp(path.p, p->h->path, path.len)) {
conn->handler = p->h->handler;
goto done;
}
Expand Down
1 change: 1 addition & 0 deletions src/uhttpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ static int uh_load_plugin(struct uh_server *srv, const char *path)

p->h = h;
p->dlh = dlh;
p->len = strlen(h->path);

if (!srvi->plugins) {
srvi->plugins = p;
Expand Down
1 change: 1 addition & 0 deletions src/uhttpd.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ struct uh_plugin_handler {
struct uh_plugin {
struct uh_plugin_handler *h;
void *dlh;
uint8_t len;
struct uh_plugin *next;
};

Expand Down

0 comments on commit 21bd2ca

Please sign in to comment.