فهرست منبع

update: http库增加对分段下载的演示

Wendal Chen 1 سال پیش
والد
کامیت
5287310e2f
1فایلهای تغییر یافته به همراه4 افزوده شده و 0 حذف شده
  1. 4 0
      components/network/libhttp/luat_lib_http.c

+ 4 - 0
components/network/libhttp/luat_lib_http.c

@@ -114,6 +114,10 @@ log.info("http.get", code, headers, body)
 
 -- 自定义超时时间, 5000ms
 http.request("GET","http://httpbin.com/", nil, nil, {timeout=5000}).wait()
+
+-- 分段下载
+local heads = {["Range"] = "bytes=0-99"} --下载0-99之间的数据
+http.request("GET","http://httpbin.air32.cn/get", heads, nil, {timeout=5000}).wait()
 */
 static int l_http_request(lua_State *L) {
 	size_t server_cert_len = 0,client_cert_len = 0, client_key_len = 0, client_password_len = 0,len = 0;