Forum: NGINX dav and dav_ext, mp4 module, PROPFIND not working for files

2974d09ac2541e892966b762aad84943?d=identicon&s=25 audvare (Guest)
on 2014-06-28 08:26
(Received via mailing list)
Somehow uploadprogress seems to be affecting a request unrelated. I am
using
Cyberduck on Windows to test WebDAV (over HTTPS). It successfully logs
in,
lists files, etc. But it does not download any files because it does not
like that PROPFIND on a file gives a 405 status. Cut down log:

2014/06/27 23:10:50 [debug] 28436#0: *569278 http request line:
"PROPFIND
/video/avgn/t_screwattack_avgn_bugsbcc_901_gt.mp4 HTTP/1.1"
2014/06/27 23:10:50 [debug] 28436#0: *569278 http uri:
"/video/avgn/t_screwattack_avgn_bugsbcc_901_gt.mp4"
2014/06/27 23:10:50 [debug] 28436#0: *569278 using configuration
"\.mp4$"
2014/06/27 23:10:50 [debug] 28436#0: *569278 http finalize request: 405,
"/video/avgn/t_screwattack_avgn_bugsbcc_901_gt.mp4?" a:1, c:1
2014/06/27 23:10:50 [debug] 28436#0: *569278 http special response: 405,
"/video/avgn/t_screwattack_avgn_bugsbcc_901_gt.mp4?"
2014/06/27 23:10:50 [debug] 28436#0: *569278 http set discard body
2014/06/27 23:10:50 [debug] 28436#0: *569278 uploadprogress
error-tracker
error: 405
2014/06/27 23:10:50 [debug] 28436#0: *569278 uploadprogress
error-tracker
not tracking in this location
2014/06/27 23:10:50 [debug] 28436#0: *569278 HTTP/1.1 405 Not Allowed
Server: nginx
Date: Sat, 28 Jun 2014 06:10:50 GMT
Content-Type: text/html
Content-Length: 166
Connection: keep-alive
Keep-Alive: timeout=20

My configuration is like this (trying to keep only relevant parts):
server {
...

    dav_methods off;
    create_full_put_path on;
    dav_access group:r all:r;
    dav_ext_methods PROPFIND OPTIONS;

    location ~ \.mp4$ {
        mp4;
        mp4_buffer_size 1m;
        mp4_max_buffer_size 5m;
    }
}

When I comment out the mp4 location the client downloads the file fine.
But
I do want to use the mp4 module to optimise for those files.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,251279,251279#msg-251279
405f7785199e6fb200f5cd68af04a5f8?d=identicon&s=25 Roman Arutyunyan (Guest)
on 2014-06-30 17:17
(Received via mailing list)
Hello!

On 28 Jun 2014, at 10:26, audvare <nginx-forum@nginx.us> wrote:

> 2014/06/27 23:10:50 [debug] 28436#0: *569278 http finalize request: 405,
> Date: Sat, 28 Jun 2014 06:10:50 GMT
>    create_full_put_path on;
> When I comment out the mp4 location the client downloads the file fine. But
> I do want to use the mp4 module to optimise for those files.

If you have mp4 directive in a location, this location will only process
GET and HEAD
requests and reply with "405 Not Allowed" to all other HTTP methods.  No
matter if you
have dav or not you will get 405 to PROPFIND/OPTIONS/PUT/etc due to mp4
module restrictions.

Currently nginx does not seem to be able to do what you want.  If youre
ready to patch
the source heres the patch fixing the issue.

diff -r 0dd77ef9f114 src/http/modules/ngx_http_mp4_module.c
--- a/src/http/modules/ngx_http_mp4_module.c    Fri Jun 27 13:06:09 2014
+0400
+++ b/src/http/modules/ngx_http_mp4_module.c    Mon Jun 30 19:10:59 2014
+0400
@@ -431,7 +431,7 @@ ngx_http_mp4_handler(ngx_http_request_t
     ngx_http_core_loc_conf_t  *clcf;

     if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD))) {
-        return NGX_HTTP_NOT_ALLOWED;
+        return NGX_DECLINED;
     }

     if (r->uri.data[r->uri.len - 1] == '/') {
2974d09ac2541e892966b762aad84943?d=identicon&s=25 audvare (Guest)
on 2014-06-30 19:37
(Received via mailing list)
Thanks. I will try this patch later today and report back.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,251279,251312#msg-251312
2974d09ac2541e892966b762aad84943?d=identicon&s=25 audvare (Guest)
on 2014-07-01 07:36
(Received via mailing list)
Roman Arutyunyan Wrote:
-------------------------------------------------------
> @@ -431,7 +431,7 @@ ngx_http_mp4_handler(ngx_http_request_t
>      ngx_http_core_loc_conf_t  *clcf;
>
>      if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD))) {
> -        return NGX_HTTP_NOT_ALLOWED;
> +        return NGX_DECLINED;
>      }
>
>      if (r->uri.data[r->uri.len - 1] == '/') {


Thanks. This works well.

< HTTP/1.1 207 Multi-Status
<?xml version="1.0" encoding="utf-8" ?>
<D:multistatus xmlns:D="DAV:">
<D:response>
<D:href>/video/avgn/t_screwattack_avgn_bugsbcc_901_gt.mp4</D:href>
<D:propstat>
<D:prop>
...

Is there any change this will make it into upstream so I don't have to
keep
on patching?

Not that I mind that much because with Gentoo and user patches it is
extremely easy but I guess I would of course be concerned that the code
may
change drastically such that the patch will stop working.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,251279,251350#msg-251350
405f7785199e6fb200f5cd68af04a5f8?d=identicon&s=25 Roman Arutyunyan (Guest)
on 2014-07-01 18:28
(Received via mailing list)
On 01 Jul 2014, at 09:35, audvare <nginx-forum@nginx.us> wrote:

>> +++ b/src/http/modules/ngx_http_mp4_module.c    Mon Jun 30 19:10:59
>
> ...
>
> Is there any change this will make it into upstream so I don't have to keep
> on patching?
>
> Not that I mind that much because with Gentoo and user patches it is
> extremely easy but I guess I would of course be concerned that the code may
> change drastically such that the patch will stop working.

Committing this into upstream is not planned.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.