[Owncloud] HEAD request to ownCloud WebDAV

Klaas Freitag freitag at owncloud.com
Fri Aug 17 13:20:01 UTC 2012


Hi

I am a bit experimenting with HEAD requests to ownCloud in order to read 
the Etag of files - it contains an unique Id which we want to use for 
syncing in the next generation sync engine.

Two questions:
1. When I do a head request with curl:
kf at jussi:~/owncloud.com/buildcsync> curl -v --basic -u "kf:XXXXX" -X 
'HEAD' http://localhost/ocm/files/webdav.php/test/my_image.jpg
* About to connect() to localhost port 80 (#0)
*   Trying ::1... connected
* Server auth using Basic with user 'kf'
 > HEAD /ocm/files/webdav.php/test/my_image.jpg HTTP/1.1
 > Authorization: Basic XXXXXXXXX
 > User-Agent: curl/7.22.0 (x86_64-unknown-linux-gnu) libcurl/7.22.0 
OpenSSL/1.0.0e zlib/1.2.5 c-ares/1.7.5 libidn/1.22 libssh2/1.2.9
 > Host: localhost
 > Accept: */*
 >
< HTTP/1.1 200 OK
< Date: Fri, 17 Aug 2012 13:12:02 GMT
< Server: Apache/2.2.21 (Linux/SUSE)
< X-Powered-By: PHP/5.3.8
< Set-Cookie: 
PHPSESSID=ghm8jefjltqnt0g86cu958cins3p8vvl4bkeqtk4o3fuk68kugg1; path=/; 
HttpOnly
< Expires: Thu, 19 Nov 1981 08:52:00 GMT
< Cache-Control: no-store, no-cache, must-revalidate, post-check=0, 
pre-check=0
< Pragma: no-cache
< Set-Cookie: 
PHPSESSID=rjbk42b470mrar5ses9i2lj21rh6nlsnv8mo4pc7l0a8vqcbpkl1; path=/; 
HttpOnly
< Content-Length: 152719
< Last-Modified: Fri, 17 Aug 2012 10:36:56 GMT
< ETag: "502e1ed93956c7.61867411"
< Content-Type: image/jpeg
<
* transfer closed with 152719 bytes remaining to read
* Closing connection #0
curl: (18) transfer closed with 152719 bytes remaining to read

mind the last line - 152719 bytes remaining to read. I thought HEAD 
requests were about not getting any body - why do we seem to have a body 
here? Or is something wrong with my request? But also note: Nice ETag 
header in there, thats what I need.

2. If I do the same request on a directory resource or collection on 
ownCloud, the result does not contain the ETag header. Can we enable 
that? Otherwise I would have to do PROPFINDs on the collection which is 
more costly than a HEAD.

Who can help?

Thanks,

Klaas



More information about the Owncloud mailing list