@@ -36,14 +36,13 @@ typedef struct {
3636 time_t mtime ;
3737 off_t size ;
3838
39- unsigned dir :1 ;
40- unsigned lock_supported :1 ;
41- unsigned lock_infinite :1 ;
42-
4339 time_t lock_expire ;
4440 ngx_str_t lock_root ;
4541 uint32_t lock_token ;
4642
43+ unsigned dir :1 ;
44+ unsigned lock_supported :1 ;
45+ unsigned lock_infinite :1 ;
4746} ngx_http_dav_ext_entry_t ;
4847
4948
@@ -294,7 +293,7 @@ ngx_http_dav_ext_strip_uri(ngx_http_request_t *r, ngx_str_t *uri)
294293 for (p = host + len ; p != last ; p ++ ) {
295294 if (* p == '/' ) {
296295 ngx_log_debug3 (NGX_LOG_DEBUG_HTTP , r -> connection -> log , 0 ,
297- "http dav_ext strip uri \"%V\" new: \"%*s\"" ,
296+ "http dav_ext strip uri \"%V\" \"%*s\"" ,
298297 uri , last - p , p );
299298
300299 uri -> data = p ;
@@ -328,13 +327,11 @@ ngx_http_dav_ext_verify_lock(ngx_http_request_t *r, ngx_str_t *uri,
328327 token = ngx_http_dav_ext_if (r , uri );
329328
330329 dlcf = ngx_http_get_module_loc_conf (r , ngx_http_dav_ext_module );
331-
332330 lock = dlcf -> shm_zone -> data ;
333331
334332 ngx_shmtx_lock (& lock -> shpool -> mutex );
335333
336334 node = ngx_http_dav_ext_lock_lookup (r , lock , uri , -1 );
337-
338335 if (node == NULL ) {
339336 ngx_shmtx_unlock (& lock -> shpool -> mutex );
340337 return NGX_OK ;
@@ -645,6 +642,7 @@ ngx_http_dav_ext_propfind_handler(ngx_http_request_t *r)
645642 xmlFreeParserCtxt (pctx );
646643
647644 if (len == 0 ) {
645+
648646 /*
649647 * For easier debugging treat bodiless requests
650648 * as if they expect all properties.
@@ -926,8 +924,8 @@ ngx_http_dav_ext_propfind(ngx_http_request_t *r, ngx_uint_t props)
926924 }
927925
928926 entry -> uri .data = p ;
929- p = ngx_cpymem (p , r -> uri .data , r -> uri .len );
930927
928+ p = ngx_cpymem (p , r -> uri .data , r -> uri .len );
931929 if (r -> uri .len && r -> uri .data [r -> uri .len - 1 ] != '/' ) {
932930 * p ++ = '/' ;
933931 }
@@ -938,7 +936,6 @@ ngx_http_dav_ext_propfind(ngx_http_request_t *r, ngx_uint_t props)
938936 }
939937
940938 entry -> uri .len = p - entry -> uri .data ;
941-
942939 entry -> dir = ngx_de_is_dir (& dir );
943940 entry -> mtime = ngx_de_mtime (& dir );
944941 entry -> size = ngx_de_size (& dir );
@@ -987,7 +984,6 @@ ngx_http_dav_ext_set_locks(ngx_http_request_t *r,
987984 ngx_shmtx_lock (& lock -> shpool -> mutex );
988985
989986 node = ngx_http_dav_ext_lock_lookup (r , lock , & entry -> uri , -1 );
990-
991987 if (node == NULL ) {
992988 ngx_shmtx_unlock (& lock -> shpool -> mutex );
993989 return NGX_OK ;
@@ -1121,7 +1117,6 @@ ngx_http_dav_ext_lock_handler(ngx_http_request_t *r)
11211117 }
11221118
11231119 dlcf = ngx_http_get_module_loc_conf (r , ngx_http_dav_ext_module );
1124-
11251120 lock = dlcf -> shm_zone -> data ;
11261121
11271122 /*
@@ -1289,10 +1284,8 @@ ngx_http_dav_ext_lock_response(ngx_http_request_t *r, ngx_uint_t status,
12891284 }
12901285
12911286 b -> last = ngx_cpymem (b -> last , head , sizeof (head ) - 1 );
1292-
12931287 b -> last = (u_char * ) ngx_http_dav_ext_format_lockdiscovery (r , b -> last ,
12941288 & entry );
1295-
12961289 b -> last = ngx_cpymem (b -> last , tail , sizeof (tail ) - 1 );
12971290
12981291 b -> last_buf = (r == r -> main ) ? 1 : 0 ;
@@ -1302,7 +1295,6 @@ ngx_http_dav_ext_lock_response(ngx_http_request_t *r, ngx_uint_t status,
13021295 cl .next = NULL ;
13031296
13041297 r -> headers_out .status = status ;
1305-
13061298 r -> headers_out .content_length_n = b -> last - b -> pos ;
13071299
13081300 r -> headers_out .content_type_len = sizeof ("text/xml" ) - 1 ;
@@ -1311,18 +1303,18 @@ ngx_http_dav_ext_lock_response(ngx_http_request_t *r, ngx_uint_t status,
13111303
13121304 ngx_str_set (& r -> headers_out .charset , "utf-8" );
13131305
1314- p = ngx_pnalloc (r -> pool , ngx_http_dav_ext_format_token (NULL , token , 1 ));
1315- if (p == NULL ) {
1316- return NGX_HTTP_INTERNAL_SERVER_ERROR ;
1317- }
1318-
13191306 h = ngx_list_push (& r -> headers_out .headers );
13201307 if (h == NULL ) {
13211308 return NGX_HTTP_INTERNAL_SERVER_ERROR ;
13221309 }
13231310
13241311 ngx_str_set (& h -> key , "Lock-Token" );
13251312
1313+ p = ngx_pnalloc (r -> pool , ngx_http_dav_ext_format_token (NULL , token , 1 ));
1314+ if (p == NULL ) {
1315+ return NGX_HTTP_INTERNAL_SERVER_ERROR ;
1316+ }
1317+
13261318 h -> value .data = p ;
13271319 h -> value .len = (u_char * ) ngx_http_dav_ext_format_token (p , token , 1 ) - p ;
13281320 h -> hash = 1 ;
@@ -1348,7 +1340,6 @@ ngx_http_dav_ext_unlock_handler(ngx_http_request_t *r)
13481340 token = ngx_http_dav_ext_lock_token (r );
13491341
13501342 dlcf = ngx_http_get_module_loc_conf (r , ngx_http_dav_ext_module );
1351-
13521343 lock = dlcf -> shm_zone -> data ;
13531344
13541345 ngx_shmtx_lock (& lock -> shpool -> mutex );
@@ -1423,7 +1414,6 @@ ngx_http_dav_ext_lock_token(ngx_http_request_t *r)
14231414 static ngx_str_t name = ngx_string ("lock-token" );
14241415
14251416 part = & r -> headers_in .headers .part ;
1426-
14271417 header = part -> elts ;
14281418
14291419 for (i = 0 ; /* void */ ; i ++ ) {
@@ -1505,7 +1495,6 @@ ngx_http_dav_ext_if(ngx_http_request_t *r, ngx_str_t *uri)
15051495 "http dav_ext if \"%V\"" , uri );
15061496
15071497 part = & r -> headers_in .headers .part ;
1508-
15091498 header = part -> elts ;
15101499
15111500 for (i = 0 ; /* void */ ; i ++ ) {
@@ -1538,11 +1527,9 @@ ngx_http_dav_ext_if(ngx_http_request_t *r, ngx_str_t *uri)
15381527
15391528 if (n == name .len && n == header [i ].key .len ) {
15401529 p = header [i ].value .data ;
1541-
15421530 tag = r -> uri ;
15431531
15441532 while (* p != '\0' ) {
1545-
15461533 ngx_log_debug1 (NGX_LOG_DEBUG_HTTP , r -> connection -> log , 0 ,
15471534 "http dav_ext if list \"%s\"" , p );
15481535
@@ -1594,7 +1581,6 @@ ngx_http_dav_ext_if(ngx_http_request_t *r, ngx_str_t *uri)
15941581 }
15951582
15961583 for ( ;; ) {
1597-
15981584 ngx_log_debug1 (NGX_LOG_DEBUG_HTTP , r -> connection -> log , 0 ,
15991585 "http dav_ext if condition \"%s\"" , p );
16001586
@@ -1644,7 +1630,6 @@ ngx_http_dav_ext_if(ngx_http_request_t *r, ngx_str_t *uri)
16441630 next :
16451631
16461632 while (* p != '\0' && * p != ' ' && * p != ')' ) { p ++ ; }
1647-
16481633 while (* p == ' ' ) { p ++ ; }
16491634
16501635 if (* p == '\0' ) {
0 commit comments