HTTP下载新功能研究

W5500的时候是OK的每次下来不会超过2049个数据 但是ESP8266看到一次过来2092个数据 装不下!

单片机内存吃紧 研究HTTP执行下载的时候对一个参数!

第一步:http://ibinhub.com/login.php 上传一个文件

 

 

 

后面开始PC茉莉

发送:
#define  HTTP_POST   "POST /data.php HTTP1.1\r\n"\
				"Host:ibinhub.com\r\n"\
				"Accept:image/gif,image/x-xbitmap,image/jpeg,image/pjpeg,*/*\r\n"\
				"User-Agent: Mozilla/4.0 (compatible;MSTE 5.5;Windows 98)\r\n"\
				"Content-Length:48\r\n"\
				"Content-Type:application/x-www-form-urlencoded\r\n"\
				"Cache-Control:no-Cache\r\n"\
				"Connection:close\r\n"\
				"\r\n"\
				"key=e784031a6b64f0bfb48e527b6463a5b8&format=json"
PC:
POST /data.php HTTP1.1
Host:ibinhub.com
Accept:image/gif,image/x-xbitmap,image/jpeg,image/pjpeg,*/*
User-Agent: Mozilla/4.0 (compatible;MSTE 5.5;Windows 98)
Content-Length:48
Content-Type:application/x-www-form-urlencoded
Cache-Control:no-Cache
Connection:close

key=e784031a6b64f0bfb48e527b6463a5b8&format=json

		
收到:
HTTP/1.1 200 OK
Date: Wed, 07 Aug 2019 01:31:27 GMT
Server: Apache/2.4.23 (Win32) OpenSSL/1.0.2h PHP/5.6.24
X-Powered-By: PHP/5.6.24
Content-Length: 211
Connection: close
Content-Type: text/html; charset=UTF-8

{"ver":"6.6","url":"http://www.ibinhub.com/upload/1395837018.bin","len":"10","hash":"md5","hashvalue":"e807f1fcf82d132f9bb018ca6738a19f","info":"鏂板缓txt鍐呭鏄?234567890閲嶅懡鍚嶄负.bin寮€濮嬫祴璇?}



已经看到版本号 名字 再次发送:
GET /upload/1395837018.bin HTTP/1.1
Host:ibinhub.com


收到:
HTTP/1.1 200 OK
Date: Wed, 07 Aug 2019 01:32:59 GMT
Server: Apache/2.4.23 (Win32) OpenSSL/1.0.2h PHP/5.6.24
Last-Modified: Tue, 06 Aug 2019 10:02:23 GMT
ETag: "a-58f6febc5cd83"
Accept-Ranges: bytes
Content-Length: 10
Content-Type: application/octet-stream

1234567890



这就是之前的一次全部拿到!!

测试新功能:
发送:
GET /upload/1395837018.bin HTTP/1.1
Host:ibinhub.com
Range: bytes=0-100


收到:HTTP/1.1 206 Partial Content
Date: Wed, 07 Aug 2019 01:34:38 GMT
Server: Apache/2.4.23 (Win32) OpenSSL/1.0.2h PHP/5.6.24
Last-Modified: Tue, 06 Aug 2019 10:02:23 GMT
ETag: "a-58f6febc5cd83"
Accept-Ranges: bytes
Content-Length: 10
Content-Range: bytes 0-9/10
Content-Type: application/octet-stream

1234567890


可以看到和上面一样!!!!因为我的文件是10个 你要100个 我也么有呀!!!

TX---
GET /upload/1395837018.bin HTTP/1.1
Host:ibinhub.com
Range: bytes=0-5


RX---
HTTP/1.1 206 Partial Content
Date: Wed, 07 Aug 2019 01:35:32 GMT
Server: Apache/2.4.23 (Win32) OpenSSL/1.0.2h PHP/5.6.24
Last-Modified: Tue, 06 Aug 2019 10:02:23 GMT
ETag: "a-58f6febc5cd83"
Accept-Ranges: bytes
Content-Length: 6
Content-Range: bytes 0-5/10
Content-Type: application/octet-stream

123456

可以看到OK啦 我只获得了其中【0--5】的6个数据


726c2dd (HEAD -> rease, origin/rease) HEAD@{0}: reset: moving to 726C2
5a01acf HEAD@{1}: reset: moving to 5A01AC

可以看到 增加一行以后 可以执行指定下载!!!

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值