Hello,

so is this patch okay for inclusion to uwsgi or  is it completely wrong? My
tests shows that it certainly helps when file is not present, but I am not
sure if I am missing something else.

Also I was wondering about how that static-safe option is supposed to be
working.

Regards,
Zdenek

2017-04-09 15:53 GMT+02:00 zd nex <[email protected]>:

> Hello,
> so here is patch to fix issue with router_static, which is not able to
> server response when file is not present. Hopefully it is okay, it compiles
> and fixes issue with empty response. With patch when file is missing
> request is sent to app - maybe now break action would work. I am not sure
> if it breaks something (settings is in previous email). Also I am wondering
> how static-safe option should work? As to get symlink working I had to
> remove these checks and compile it again.
>
>
> diff -r 0a150315584e plugins/router_static/router_static.c
> --- a/plugins/router_static/router_static.c    Sun Apr 09 15:29:02 2017
> +0200
> +++ b/plugins/router_static/router_static.c    Sun Apr 09 15:37:01 2017
> +0200
> @@ -30,8 +30,12 @@
>      struct uwsgi_buffer *ub = uwsgi_routing_translate(wsgi_req, ur,
> *subject, *subject_len, ur->data, ur->data_len);
>          if (!ub) return UWSGI_ROUTE_BREAK;
>
> -    uwsgi_file_serve(wsgi_req, ub->buf, ub->pos, NULL, 0, 1);
> +   int file_serve_ret;
> +   file_serve_ret = uwsgi_file_serve(wsgi_req, ub->buf, ub->pos, NULL, 0,
> 1);
>      uwsgi_buffer_destroy(ub);
> +   if(file_serve_ret == -1){
> +       return UWSGI_ROUTE_NEXT;
> +   }
>      if (ur->custom == 1)
>          return UWSGI_ROUTE_NEXT;
>      return UWSGI_ROUTE_BREAK;
>
>
>
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to