Skip to content

Commit

Permalink
fixed --static-index when methods different from GET/HEAD are in place
Browse files Browse the repository at this point in the history
  • Loading branch information
unbit committed Mar 10, 2013
1 parent 3f731e2 commit 5631dca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
7 changes: 1 addition & 6 deletions core/protocol.c
Expand Up @@ -759,12 +759,7 @@ int uwsgi_parse_vars(struct wsgi_request *wsgi_req) {
}


// check for static files

// skip methods other than GET and HEAD
if (uwsgi_strncmp(wsgi_req->method, wsgi_req->method_len, "GET", 3) && uwsgi_strncmp(wsgi_req->method, wsgi_req->method_len, "HEAD", 4)) {
return 0;
}
/* CHECK FOR STATIC FILES */

// skip extensions
struct uwsgi_string_list *sse = uwsgi.static_skip_ext;
Expand Down
10 changes: 10 additions & 0 deletions core/static.c
Expand Up @@ -582,6 +582,16 @@ int uwsgi_file_serve(struct wsgi_request *wsgi_req, char *document_root, uint16_

if (!uwsgi_static_stat(real_filename, &real_filename_len, &st)) {

// skip methods other than GET and HEAD
if (uwsgi_strncmp(wsgi_req->method, wsgi_req->method_len, "GET", 3) && uwsgi_strncmp(wsgi_req->method, wsgi_req->method_len, "HEAD", 4)) {
#ifdef UWSGI_ROUTING
if (uwsgi_apply_routes_fast(wsgi_req, real_filename, real_filename_len) == UWSGI_ROUTE_BREAK)
return 0;
#endif
return -1;
}


// check for skippable ext
struct uwsgi_string_list *sse = uwsgi.static_skip_ext;
while (sse) {
Expand Down

0 comments on commit 5631dca

Please sign in to comment.