@@ -369,13 +369,15 @@ static int do_request(ne_session *sess, const char *path, int depth,
369
369
#define LOCK_MODPARENT (0x01)
370
370
/* Enable SharePoint hacks. */
371
371
#define LOCK_SHAREPOINT (0x02)
372
+ /* Use a MOVE request. */
373
+ #define LOCK_MOVE (0x04)
372
374
373
375
/* Tests If: header submission, for a lock of depth 'lockdepth' at
374
376
* 'lockpath', with a request to 'reqpath' which Depth header of
375
377
* 'reqdepth'. 'flags' is bitwise-or of LOCK_* flags above. */
376
- static int submit_test (const char * lockpath , int lockdepth ,
377
- const char * reqpath , int reqdepth ,
378
- unsigned int flags )
378
+ static int submit_test2 (const char * lockpath , int lockdepth ,
379
+ const char * path1 , const char * path2 ,
380
+ int reqdepth , unsigned int flags )
379
381
{
380
382
ne_lock_store * store = ne_lockstore_create ();
381
383
ne_session * sess ;
@@ -403,7 +405,13 @@ static int submit_test(const char *lockpath, int lockdepth,
403
405
ne_lockstore_register (store , sess );
404
406
ne_lockstore_add (store , lk );
405
407
406
- ret = do_request (sess , reqpath , reqdepth , flags & LOCK_MODPARENT );
408
+ if (flags & LOCK_MOVE ) {
409
+ ret = ne_move (sess , 0 , path1 , path2 );
410
+ if (ret )
411
+ t_context ("MOVE failed: %s" , ne_get_error (sess ));
412
+ }
413
+ else
414
+ ret = do_request (sess , path1 , reqdepth , flags & LOCK_MODPARENT );
407
415
CALL (await_server ());
408
416
409
417
ne_lockstore_destroy (store );
@@ -412,6 +420,19 @@ static int submit_test(const char *lockpath, int lockdepth,
412
420
return ret ;
413
421
}
414
422
423
+ /* Tests If: header submission, for a lock of depth 'lockdepth' at
424
+ * 'lockpath', with a request to 'reqpath' which Depth header of
425
+ * 'reqdepth'. 'flags' is bitwise-or of LOCK_* flags above. */
426
+ static int submit_test (const char * lockpath , int lockdepth ,
427
+ const char * reqpath , int reqdepth ,
428
+ unsigned int flags )
429
+ {
430
+ return submit_test2 (lockpath , lockdepth ,
431
+ reqpath , NULL , reqdepth ,
432
+ flags );
433
+ }
434
+
435
+
415
436
static int if_simple (void )
416
437
{
417
438
return submit_test ("/foo" , 0 , "/foo" , 0 , 0 );
@@ -448,6 +469,11 @@ static int if_sharepoint(void)
448
469
LOCK_SHAREPOINT );
449
470
}
450
471
472
+ static int if_movefrom (void )
473
+ {
474
+ return submit_test2 ("/from" , 0 , "/from/here.txt" , "/to" , 0 , LOCK_MOVE );
475
+ }
476
+
451
477
static int serve_discovery (ne_socket * sock , void * userdata )
452
478
{
453
479
char buf [BUFSIZ ], * resp = userdata ;
@@ -703,6 +729,7 @@ ne_test tests[] = {
703
729
T (if_child ),
704
730
T (if_covered_child ),
705
731
T (if_sharepoint ),
732
+ T (if_movefrom ),
706
733
T (lock_timeout ),
707
734
T (lock_long_timeout ),
708
735
T (lock_shared ),
0 commit comments