开发者社区> 问答> 正文

求助,用libcurl使用Range不起作用


> GET /welcome2myspace/oss_test.txt HTTP/1.1
Host: storage.aliyun.com
Accept: */*
Range:bytes=0-6
Authorization: OSS abysmn89uz488l1dfycon3qa:0FD89ZOhRYo4 Bj6NtBzMkXZVF8=
Date:Wed, 17 Oct 2012 04:42:30 GMT


* additional stuff not fine transfer.c:1037: 0 0
* HTTP 1.1 or later with persistent connection, pipelining supported
< HTTP/1.1 200 OK
< Date: Wed, 17 Oct 2012 04:42:30 GMT
< Content-Type: text/html
< Connection: close
< Content-Disposition: attachment; filename=oss_test.txt
< Content-Length: 6
< ETag: "B1946AC92492D2347C6235B4D2611184"
< Last-Modified: Sat, 13 Oct 2012 09:23:47 GMT
< Server: AliyunOSS
< x-oss-request-id: 507E37364DEF3FD5660559C0
<
* Closing connection #0


求指点

展开
收起
lch.com 2012-10-17 12:51:06 11903 0
2 条回答
写回答
取消 提交回答
  • Re求助,用libcurl使用Range不起作用
    不是起作用了么
    Content-Length: 6
    2012-10-21 11:10:00
    赞同 展开评论 打赏
  • Re求助,用libcurl使用Range不起作用

    -------------------------

    Re求助,用libcurl使用Range不起作用
    > GET /welcome2myspace/oss_test.txt HTTP/1.1
    Host: storage.aliyun.com
    Accept: */*
    Range:bytes=2-6
    Authorization: OSS abysmn89uz488l1dfycon3qa:9Ec/1r8xqgymrDoA37jjdX7 APc=
    Date:Sun, 21 Oct 2012 05:28:41 GMT

    * additional stuff not fine transfer.c:1037: 0 0
    * HTTP 1.1 or later with persistent connection, pipelining supported
    < HTTP/1.1 200 OK
    < Date: Sun, 21 Oct 2012 05:28:46 GMT
    < Content-Type: text/html
    < Connection: close
    < Content-Disposition: attachment; filename=oss_test.txt
    < Content-Length: 6
    < ETag: "B1946AC92492D2347C6235B4D2611184"
    < Last-Modified: Sat, 13 Oct 2012 09:23:47 GMT
    < Server: AliyunOSS
    < x-oss-request-id: 5083880E5037C20E3CB86320
    <
    * Closing connection #0

    文档上应该返回这样的吧
    HTTP/1.1 206 Partial Content
    x-oss-request-id: 28f6508f-15ea-8224-234e-c0ce40734b89
    Date: Fri, 28 Feb 2012 05:38:42 GMT
    Last-Modified: Fri, 24 Feb 2012 06:07:48 GMT
    ETag: "5B3C1A2E053D763E1B002CC607C5A0FE "
    Accept-Ranges: bytes
    Content-Range: bytes 100-900/344606
    Content-Type: image/jpg
    Content-Length: 801
    Server: AliyunOSS

    -------------------------

    Re求助,用libcurl使用Range不起作用
    我错了,文件的最后一段的值应该是content-length-1才对
    > GET /welcome2myspace/oss_test.txt HTTP/1.1
    Host: storage.aliyun.com
    Range:bytes=2-5
    Authorization: OSS abysmn89uz488l1dfycon3qa:s5sm9SRp8CNZtzWF 9Elb3O8PPA=
    Date:Mon, 22 Oct 2012 10:11:30 GMT

    * additional stuff not fine transfer.c:1037: 0 0
    * HTTP 1.1 or later with persistent connection, pipelining supported
    < HTTP/1.1 206 Partial Content
    < Date: Mon, 22 Oct 2012 10:11:30 GMT
    < Content-Type: text/html
    < Connection: close
    < Accept-Ranges: bytes
    < Content-Disposition: attachment; filename=oss_test.txt
    < Content-Length: 4
    < Content-Range: bytes 2-5/6
    < ETag: "B1946AC92492D2347C6235B4D2611184"
    < Last-Modified: Sat, 13 Oct 2012 09:23:47 GMT
    < Server: AliyunOSS
    < x-oss-request-id: 50851BD28D954A2B79EF0C06
    <
    * Closing connection #0
    2012-10-20 17:28:45
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载