Skip to content

Commit

Permalink
implemente static-next router, #1357
Browse files Browse the repository at this point in the history
  • Loading branch information
unbit committed Sep 6, 2016
1 parent 9930553 commit 1ed9bd2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion plugins/router_static/router_static.c
Expand Up @@ -32,6 +32,8 @@ int uwsgi_routing_func_static(struct wsgi_request *wsgi_req, struct uwsgi_route

uwsgi_file_serve(wsgi_req, ub->buf, ub->pos, NULL, 0, 1);
uwsgi_buffer_destroy(ub);
if (ur->custom == 1)
return UWSGI_ROUTE_NEXT;
return UWSGI_ROUTE_BREAK;
}

Expand Down Expand Up @@ -269,13 +271,17 @@ int uwsgi_routing_func_fastfile(struct wsgi_request *wsgi_req, struct uwsgi_rout


static int uwsgi_router_static(struct uwsgi_route *ur, char *args) {

ur->func = uwsgi_routing_func_static;
ur->data = args;
ur->data_len = strlen(args);
return 0;
}

static int uwsgi_router_static_next(struct uwsgi_route *ur, char *args) {
ur->custom = 1;
return uwsgi_router_static(ur, args);
}

static int uwsgi_router_file(struct uwsgi_route *ur, char *args) {
ur->func = uwsgi_routing_func_file;
ur->data = args;
Expand Down Expand Up @@ -350,6 +356,7 @@ static int uwsgi_router_fastfile_next(struct uwsgi_route *ur, char *args) {
static void router_static_register(void) {

uwsgi_register_router("static", uwsgi_router_static);
uwsgi_register_router("static-next", uwsgi_router_static_next);
uwsgi_register_router("file", uwsgi_router_file);
uwsgi_register_router("file-next", uwsgi_router_file_next);
uwsgi_register_router("sendfile", uwsgi_router_sendfile);
Expand Down

0 comments on commit 1ed9bd2

Please sign in to comment.