howdy fellas,
when downloading file using the downloadfile (GetFile?) api, what distinguish between failure and a successful download of a file with one of the two following contents snippets:
<response>
<result>-20</result>
<message>Requested resource "path/resourcename" not found</message>
</response>
<response>
<result>-29</result>
<message>user “user” not found </message>
</response>
as a suggestion, only for this request, can we have the server passing a http header that actually indicates a success or failure?
My issue with downloadfile is to tell the size of what is being downloaded. The response from downloadfile looks like this:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Set-Cookie: r_sessionid=1186609292783_3221551951820651387
Set-Cookie: edu.yale.its.tp.cas.client.filter.user=Voidmain
Server: Omnidrive State representation engine v0.7.0
Content-Type: application/octet-stream
Transfer-Encoding: chunked
Date: Wed, 08 Aug 2007 21:41:32 GMT
Without Content-Length being passed back in the header i'm unable to determine the total bytes of what is being downloaded.
An example of a response with Content-Length looks like the following:
HTTP/1.0 200 OK
Date: Wed, 08 Aug 2007 16:39:11 GMT
Server: Apache/2.0.52 (Red Hat)
Cache-Control: max-age=315360000
Expires: Mon, 28 Jul 2014 23:30:00 GMT
Last-Modified: Sat, 28 Jul 2007 20:03:44 GMT
Accept-Ranges: bytes
Content-Length: 6954
Content-Type: image/jpeg
Age: 18838
X-Cache: HIT from photocache203.flickr.sp1.yahoo.com
Via: 1.0 photocache203.flickr.sp1.yahoo.com:80 (squid/2.6.STABLE10)
Connection: keep-alive
Without the Content-Length being returned the only alternative I see is to get the file properties before downloading. Is there something i'm missing here? Can you get the Content-Length without a header value?
Thanks for any help. -Steve
So i've figured out that the Content-Length will not show up if Transfer-Encoding: chunked
http://www.jmarshall.com/easy/http/#http1.1c2
Now it looks like I have the size of the chunk data:
Example Response:
Server: Apache-Coyote/1.1
Server: Omnidrive State representation engine v0.7.0
Content-Type: application/octet-stream
Transfer-Encoding: chunked
Date: Thu, 09 Aug 2007 17:07:37 GMT
2000
ID3 T2 ! The Scientist [live in Brussels].........
It doesn't look like there is anyway to figure out what the total length of the message body will be based on the Chunked stream of data. Can anyone confirm that so i can stop looking?
Thanks much -Steve
Sending ...