174 stderr, |
174 stderr, |
175 " set-property [-pc] [-L <lock>] [-n <uri>] <url> <property> [value]\n"); |
175 " set-property [-pc] [-L <lock>] [-n <uri>] <url> <property> [value]\n"); |
176 fprintf( |
176 fprintf( |
177 stderr, |
177 stderr, |
178 " remove-property [-pc] [-n <uri>] <url> <property>\n"); |
178 " remove-property [-pc] [-n <uri>] <url> <property>\n"); |
179 fprintf(stderr, " lock [-pc] <url>\n"); |
179 fprintf(stderr, " lock [-pc] [-T timeout] <url>\n"); |
180 fprintf(stderr, " unlock [-pc] [-L <lock>] <url>\n"); |
180 fprintf(stderr, " unlock [-pc] [-L <lock>] <url>\n"); |
181 fprintf(stderr, " info [-pc] <url>\n"); |
181 fprintf(stderr, " info [-pc] <url>\n"); |
182 fprintf(stderr, " date [url]\n"); |
182 fprintf(stderr, " date [url]\n"); |
183 fprintf(stderr, "\n"); |
183 fprintf(stderr, "\n"); |
184 fprintf(stderr, "Options:\n"); |
184 fprintf(stderr, "Options:\n"); |
199 fprintf(stderr, " -t print content type\n"); |
199 fprintf(stderr, " -t print content type\n"); |
200 fprintf(stderr, " -d order by last modified date\n"); |
200 fprintf(stderr, " -d order by last modified date\n"); |
201 fprintf(stderr, " -e show extended flags\n"); |
201 fprintf(stderr, " -e show extended flags\n"); |
202 fprintf(stderr, " -O override resources\n"); |
202 fprintf(stderr, " -O override resources\n"); |
203 fprintf(stderr, " -L <lock> specificy lock token\n"); |
203 fprintf(stderr, " -L <lock> specificy lock token\n"); |
|
204 fprintf(stderr, " -T <sec> timeout in seconds\n"); |
204 fprintf(stderr, " -n <uri> specify namespace uri\n"); |
205 fprintf(stderr, " -n <uri> specify namespace uri\n"); |
205 fprintf(stderr, " -N disable authentication prompt (all commands)\n"); |
206 fprintf(stderr, " -N disable authentication prompt (all commands)\n"); |
206 fprintf(stderr, " -i disable cert verification (all commands)\n"); |
207 fprintf(stderr, " -i disable cert verification (all commands)\n"); |
207 fprintf(stderr, " -v verbose output (all commands)\n"); |
208 fprintf(stderr, " -v verbose output (all commands)\n"); |
208 fprintf(stderr, "\n"); |
209 fprintf(stderr, "\n"); |
1320 |
1321 |
1321 if(set_session_config(sn, a)) { |
1322 if(set_session_config(sn, a)) { |
1322 return -1; |
1323 return -1; |
1323 } |
1324 } |
1324 |
1325 |
|
1326 time_t timeout = 0; |
|
1327 char *timeoutstr = cmd_getoption(a, "timeout"); |
|
1328 if(timeoutstr) { |
|
1329 if(!sstrcasecmp(sstr(timeoutstr), S("infinity"))) { |
|
1330 timeout = -1; |
|
1331 } else { |
|
1332 timeout = (time_t)atoi(timeoutstr); // TODO: use strtol |
|
1333 } |
|
1334 } |
|
1335 |
1325 DavResource *res = dav_resource_new(sn, path); |
1336 DavResource *res = dav_resource_new(sn, path); |
1326 for(int i=0;i<2;i++) { |
1337 for(int i=0;i<2;i++) { |
1327 if(!dav_lock(res)) { |
1338 if(!dav_lock_t(res, timeout)) { |
1328 break; |
1339 break; |
1329 } |
1340 } |
1330 if(i == 0 && sn->error == DAV_UNAUTHORIZED && request_auth(repo, sn, a)) { |
1341 if(i == 0 && sn->error == DAV_UNAUTHORIZED && request_auth(repo, sn, a)) { |
1331 continue; |
1342 continue; |
1332 } |
1343 } |