Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http_makerequest 中https下载起始位置错误 #419

Open
634742472 opened this issue Dec 7, 2021 · 0 comments
Open

http_makerequest 中https下载起始位置错误 #419

634742472 opened this issue Dec 7, 2021 · 0 comments

Comments

@634742472
Copy link

  • Describe the bug
    https下载文件中,协议中,Range:设置范围是不是应该从0开始,而不是从1开始,该文件是:ota_https.c,版本号是:
    SHA-1:1d90ab9bb4cdcb654d16fbdd5f039c13a9f6c48e

  • To Reproduce
    Steps to reproduce the behavior:

    • step 1 http_makerequest函数原型实现如下,是设置了range从1开始,导致云端会从ota文件的第二字节开始返回,而不是实际的第一字节:
      static int http_makerequest(http_section_t *section)
      {
      int ret;
      ret = snprintf((char *)section->cache,CONFIG_HTTPS_DOWNLOADING_BLKLEN,CN_OTA_HTTPS_REQ_FMT,section->url_re,
      section->bearer,section->host,section->port,section->offset + 1, section->offset + section->len); ///< start from 1
      return ret;
      }
      这样的话云端返回数据第一字节就已经不匹配了
  • Expected behavior
    正常应该是从ota文件第一字节开始传输,而不是从第二字节传输,http文件下载协议是range字段设置是从0开始的,不是从1开始

  • Current behavior
    当前表现,云端会直接从发ota文件第二字节数据,最后数据少发送1字节,并且超时(因为实际接收字节数与期望接收字节数不一致)

  • Please tell us about your environment:

    • LiteOS Version: iot_link
    • Chip Architecture:ARM
    • Board: NO
    • SHA-1:1d90ab9bb4cdcb654d16fbdd5f039c13a9f6c48e
  • Other information (当前经过修改后代码如下,设置range从0开始后,云端返回数据就正常,但没有对section->len进行判断(如果为0,那该range字段应该是错误的):)

static int http_makerequest(http_section_t *section)
{
      int ret;
      ret = snprintf((char *)section->cache,CONFIG_HTTPS_DOWNLOADING_BLKLEN,CN_OTA_HTTPS_REQ_FMT,section->url_re,\
              section->bearer,section->host,section->port,section->offset , section->offset + section->len -1); ///< start from 1
      return ret;
}
@634742472 634742472 changed the title http_makerequest 中https下载起始位置 http_makerequest 中https下载起始位置错误 Dec 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant