download_client: Peer closed connection!

Hi

I am using FOTA DOWNLOAD to update device's application firmware.

https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/nrf/libraries/networking/fota_download.html

My Environment

Device : nrf1960
SDK version : v1.9.1

prj.conf

# Modem library
CONFIG_NRF_MODEM_LIB=y
#CONFIG_POSIX_MAX_FDS=8
CONFIG_MODEM_INFO=y

CONFIG_MODEM_KEY_MGMT=y
CONFIG_DOWNLOAD_CLIENT=y

# appication fota update configuration
CONFIG_FOTA_DOWNLOAD=y
CONFIG_FOTA_SOCKET_RETRIES=10
CONFIG_DOWNLOAD_HOST="mydomain.com"
CONFIG_DOWNLOAD_FILE="https://mydomain.com/im830/app_update.bin"

#DFU 
CONFIG_DFU_TARGET=y

# MCUBOOT
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_MCUBOOT_IMG_MANAGER=y

# Image manager
CONFIG_IMG_MANAGER=y
CONFIG_IMG_ERASE_PROGRESSIVELY=y

# Download client
CONFIG_DOWNLOAD_CLIENT_STACK_SIZE=4096
CONFIG_DOWNLOAD_CLIENT_BUF_SIZE=4096
CONFIG_DOWNLOAD_CLIENT_HTTP_FRAG_SIZE_1024=y
CONFIG_DOWNLOAD_CLIENT_RANGE_REQUESTS=y
CONFIG_DOWNLOAD_CLIENT_LOG_LEVEL_DBG=y
CONFIG_DOWNLOAD_CLIENT_LOG_HEADERS=y

error log

[00:00:35.346,374] <dbg> download_client: client_connect: Protocol not specified, defaulting to HTTP(S)
[00:00:35.346,405] <dbg> download_client: client_connect: Port not specified, using default: 443
[00:00:35.346,405] <dbg> download_client: client_connect: family: 1, type: 1, proto: 258
[00:00:35.346,862] <inf> download_client: Setting up TLS credentials, tag 42
[00:00:35.346,954] <inf> download_client: Configuring socket timeout (30 s)
[00:00:35.346,984] <inf> download_client: Connecting to mydomain.com
[00:00:35.347,015] <dbg> download_client: client_connect: fd 1, addrlen 8, fam IPv4, port 443
[00:00:36.968,261] <inf> cpu_load: Load:9,001%
[00:00:37.306,304] <dbg> download_client: http_get_request_send: HTTP request
                                          47 45 54 20 2f 69 6d 38  33 30 2f 61 70 70 5f 75 |GET /im8 30/app_u
                                          70 64 61 74 65 2e 62 69  6e 20 48 54 54 50 2f 31 |pdate.bi n HTTP/1
                                          2e 31 0d 0a 48 6f 73 74  3a 20 73 74 67 2d 6d 63 |.1..Host : stg-mc
                                          2d 72 65 70 6f 2e 6d 63  61 70 70 73 2e 6a 70 0d |-repo.mc apps.jp.
                                          0a 52 61 6e 67 65 3a 20  62 79 74 65 73 3d 30 2d |.Range:  bytes=0-
                                          32 30 34 37 0d 0a 41 75  74 68 6f 72 69 7a 61 74 |2047..Au thorizat
                                          69 6f 6e 3a 20 42 61 73  69 63 20 56 45 35 52 59 |ion: Bas ic VE5RY
                                          6c 52 68 57 58 5a 6a 5a  53 31 6a 4f 6c 4e 43 59 |lRhWXZjZ S1jOlNCY
                                          58 49 74 57 47 52 44 4e  6a 6c 48 55 41 3d 3d 0d |XItWGRDN jlHUA==.
                                          0a 43 6f 6e 6e 65 63 74  69 6f 6e 3a 20 6b 65 65 |.Connect ion: kee
                                          70 2d 61 6c 69 76 65 0d  0a 0d 0a                |p-alive. ...     
[00:00:37.307,067] <inf> download_client: Downloading: https://mydomain.com/im830/app_update.bin [0]
[00:00:37.308,837] <dbg> download_client: download_thread: Receiving up to 4096 bytes at 0x20011564...
[00:00:37.572,174] <dbg> download_client: download_thread: Read 522 bytes from socket
[00:00:37.572,265] <dbg> download_client: http_header_parse: GET header size: 522
[00:00:37.572,631] <dbg> download_client: http_header_parse: File size = 347875
[00:00:37.572,784] <dbg> download_client: download_thread: Receiving up to 4096 bytes at 0x20011564...
[00:00:37.939,666] <dbg> download_client: download_thread: Read 1024 bytes from socket
[00:00:37.939,697] <dbg> download_client: download_thread: Receiving up to 3072 bytes at 0x20011964...
[00:00:37.939,941] <dbg> download_client: download_thread: Read 1024 bytes from socket
[00:00:37.939,941] <inf> download_client: Downloaded 2048/347875 bytes (0%)
[00:00:38.101,257] <dbg> download_client: http_get_request_send: HTTP request
                                          47 45 54 20 2f 69 6d 38  33 30 2f 61 70 70 5f 75 |GET /im8 30/app_u
                                          70 64 61 74 65 2e 62 69  6e 20 48 54 54 50 2f 31 |pdate.bi n HTTP/1
                                          2e 31 0d 0a 48 6f 73 74  3a 20 73 74 67 2d 6d 63 |.1..Host : stg-mc
                                          2d 72 65 70 6f 2e 6d 63  61 70 70 73 2e 6a 70 0d |-repo.mc apps.jp.
                                          0a 52 61 6e 67 65 3a 20  62 79 74 65 73 3d 32 30 |.Range:  bytes=20
                                          34 38 2d 34 30 39 35 0d  0a 41 75 74 68 6f 72 69 |48-4095. .Authori
                                          7a 61 74 69 6f 6e 3a 20  42 61 73 69 63 20 56 45 |zation:  Basic VE
                                          35 52 59 6c 52 68 57 58  5a 6a 5a 53 31 6a 4f 6c |5RYlRhWX ZjZS1jOl
                                          4e 43 59 58 49 74 57 47  52 44 4e 6a 6c 48 55 41 |NCYXItWG RDNjlHUA
                                          3d 3d 0d 0a 43 6f 6e 6e  65 63 74 69 6f 6e 3a 20 |==..Conn ection: 
                                          6b 65 65 70 2d 61 6c 69  76 65 0d 0a 0d 0a       |keep-ali ve....  
[00:00:38.117,584] <dbg> download_client: download_thread: Receiving up to 4096 bytes at 0x20011564...
[00:00:38.398,864] <wrn> download_client: Peer closed connection!
[00:00:38.398,864] <wrn> fota_download: Download socket error. 10 retries left...
[00:00:38.398,864] <inf> download_client: Reconnecting..
[00:00:38.400,146] <dbg> download_client: client_connect: Protocol not specified, defaulting to HTTP(S)
[00:00:38.400,177] <dbg> download_client: client_connect: Port not specified, using default: 443
[00:00:38.400,177] <dbg> download_client: client_connect: family: 1, type: 1, proto: 258
[00:00:38.400,573] <inf> download_client: Setting up TLS credentials, tag 42
[00:00:38.400,665] <inf> download_client: Configuring socket timeout (30 s)
[00:00:38.400,695] <inf> download_client: Connecting to mydomain.com
[00:00:38.400,756] <dbg> download_client: client_connect: fd 1, addrlen 8, fam IPv4, port 443
[00:00:38.968,353] <inf> cpu_load: Load:17,928%
[00:00:40.818,664] <dbg> download_client: http_get_request_send: HTTP request
                                          47 45 54 20 2f 69 6d 38  33 30 2f 61 70 70 5f 75 |GET /im8 30/app_u
                                          70 64 61 74 65 2e 62 69  6e 20 48 54 54 50 2f 31 |pdate.bi n HTTP/1
                                          2e 31 0d 0a 48 6f 73 74  3a 20 73 74 67 2d 6d 63 |.1..Host : stg-mc
                                          2d 72 65 70 6f 2e 6d 63  61 70 70 73 2e 6a 70 0d |-repo.mc apps.jp.
                                          0a 52 61 6e 67 65 3a 20  62 79 74 65 73 3d 32 30 |.Range:  bytes=20
                                          34 38 2d 34 30 39 35 0d  0a 41 75 74 68 6f 72 69 |48-4095. .Authori
                                          7a 61 74 69 6f 6e 3a 20  42 61 73 69 63 20 56 45 |zation:  Basic VE
                                          35 52 59 6c 52 68 57 58  5a 6a 5a 53 31 6a 4f 6c |5RYlRhWX ZjZS1jOl
                                          4e 43 59 58 49 74 57 47  52 44 4e 6a 6c 48 55 41 |NCYXItWG RDNjlHUA
                                          3d 3d 0d 0a 43 6f 6e 6e  65 63 74 69 6f 6e 3a 20 |==..Conn ection: 
                                          6b 65 65 70 2d 61 6c 69  76 65 0d 0a 0d 0a       |keep-ali ve....  
[00:00:40.819,671] <dbg> download_client: download_thread: Receiving up to 4096 bytes at 0x20011564...
[00:00:40.968,444] <inf> cpu_load: Load:9,007%
[00:00:41.210,449] <dbg> download_client: download_thread: Read 525 bytes from socket
[00:00:41.210,540] <dbg> download_client: http_header_parse: GET header size: 525
[00:00:41.210,968] <dbg> download_client: download_thread: Receiving up to 4096 bytes at 0x20011564...
[00:00:41.788,726] <dbg> download_client: download_thread: Read 2048 bytes from socket
[00:00:41.788,726] <inf> download_client: Downloaded 4096/347875 bytes (1%)
[00:00:41.812,286] <dbg> download_client: http_get_request_send: HTTP request
                                          47 45 54 20 2f 69 6d 38  33 30 2f 61 70 70 5f 75 |GET /im8 30/app_u
                                          70 64 61 74 65 2e 62 69  6e 20 48 54 54 50 2f 31 |pdate.bi n HTTP/1
                                          2e 31 0d 0a 48 6f 73 74  3a 20 73 74 67 2d 6d 63 |.1..Host : stg-mc
                                          2d 72 65 70 6f 2e 6d 63  61 70 70 73 2e 6a 70 0d |-repo.mc apps.jp.
                                          0a 52 61 6e 67 65 3a 20  62 79 74 65 73 3d 34 30 |.Range:  bytes=40
                                          39 36 2d 36 31 34 33 0d  0a 41 75 74 68 6f 72 69 |96-6143. .Authori
                                          7a 61 74 69 6f 6e 3a 20  42 61 73 69 63 20 56 45 |zation:  Basic VE
                                          35 52 59 6c 52 68 57 58  5a 6a 5a 53 31 6a 4f 6c |5RYlRhWX ZjZS1jOl
                                          4e 43 59 58 49 74 57 47  52 44 4e 6a 6c 48 55 41 |NCYXItWG RDNjlHUA
                                          3d 3d 0d 0a 43 6f 6e 6e  65 63 74 69 6f 6e 3a 20 |==..Conn ection: 
                                          6b 65 65 70 2d 61 6c 69  76 65 0d 0a 0d 0a       |keep-ali ve....  
[00:00:41.813,323] <dbg> download_client: download_thread: Receiving up to 4096 bytes at 0x20011564...
[00:00:42.139,739] <dbg> download_client: download_thread: Read 525 bytes from socket
[00:00:42.139,862] <dbg> download_client: http_header_parse: GET header size: 525
[00:00:42.140,319] <dbg> download_client: download_thread: Receiving up to 4096 bytes at 0x20011564...
[00:00:42.579,284] <dbg> download_client: download_thread: Read 2048 bytes from socket
[00:00:42.579,284] <inf> download_client: Downloaded 6144/347875 bytes (1%)
[00:00:42.740,905] <dbg> download_client: http_get_request_send: HTTP request
                                          47 45 54 20 2f 69 6d 38  33 30 2f 61 70 70 5f 75 |GET /im8 30/app_u
                                          70 64 61 74 65 2e 62 69  6e 20 48 54 54 50 2f 31 |pdate.bi n HTTP/1
                                          2e 31 0d 0a 48 6f 73 74  3a 20 73 74 67 2d 6d 63 |.1..Host : stg-mc
                                          2d 72 65 70 6f 2e 6d 63  61 70 70 73 2e 6a 70 0d |-repo.mc apps.jp.
                                          0a 52 61 6e 67 65 3a 20  62 79 74 65 73 3d 36 31 |.Range:  bytes=61
                                          34 34 2d 38 31 39 31 0d  0a 41 75 74 68 6f 72 69 |44-8191. .Authori
                                          7a 61 74 69 6f 6e 3a 20  42 61 73 69 63 20 56 45 |zation:  Basic VE
                                          35 52 59 6c 52 68 57 58  5a 6a 5a 53 31 6a 4f 6c |5RYlRhWX ZjZS1jOl
                                          4e 43 59 58 49 74 57 47  52 44 4e 6a 6c 48 55 41 |NCYXItWG RDNjlHUA
                                          3d 3d 0d 0a 43 6f 6e 6e  65 63 74 69 6f 6e 3a 20 |==..Conn ection: 
                                          6b 65 65 70 2d 61 6c 69  76 65 0d 0a 0d 0a       |keep-ali ve....  
[00:00:42.741,729] <dbg> download_client: download_thread: Receiving up to 4096 bytes at 0x20011564...
[00:00:42.968,536] <inf> cpu_load: Load:18,664%
[00:00:43.106,964] <wrn> download_client: Peer closed connection!
[00:00:43.106,964] <wrn> fota_download: Download socket error. 9 retries left...
[00:00:43.106,994] <inf> download_client: Reconnecting..
[00:00:43.126,129] <dbg> download_client: client_connect: Protocol not specified, defaulting to HTTP(S)
[00:00:43.126,159] <dbg> download_client: client_connect: Port not specified, using default: 443
[00:00:43.126,190] <dbg> download_client: client_connect: family: 1, type: 1, proto: 258
[00:00:43.126,525] <inf> download_client: Setting up TLS credentials, tag 42
[00:00:43.126,617] <inf> download_client: Configuring socket timeout (30 s)
[00:00:43.126,647] <inf> download_client: Connecting to mydomain.com
[00:00:43.126,678] <dbg> download_client: client_connect: fd 1, addrlen 8, fam IPv4, port 443
[00:00:44.968,627] <inf> cpu_load: Load:9,966%
[00:00:44.986,785] <dbg> download_client: http_get_request_send: HTTP request
                                          47 45 54 20 2f 69 6d 38  33 30 2f 61 70 70 5f 75 |GET /im8 30/app_u
                                          70 64 61 74 65 2e 62 69  6e 20 48 54 54 50 2f 31 |pdate.bi n HTTP/1
                                          2e 31 0d 0a 48 6f 73 74  3a 20 73 74 67 2d 6d 63 |.1..Host : stg-mc
                                          2d 72 65 70 6f 2e 6d 63  61 70 70 73 2e 6a 70 0d |-repo.mc apps.jp.
                                          0a 52 61 6e 67 65 3a 20  62 79 74 65 73 3d 36 31 |.Range:  bytes=61
                                          34 34 2d 38 31 39 31 0d  0a 41 75 74 68 6f 72 69 |44-8191. .Authori
                                          7a 61 74 69 6f 6e 3a 20  42 61 73 69 63 20 56 45 |zation:  Basic VE
                                          35 52 59 6c 52 68 57 58  5a 6a 5a 53 31 6a 4f 6c |5RYlRhWX ZjZS1jOl
                                          4e 43 59 58 49 74 57 47  52 44 4e 6a 6c 48 55 41 |NCYXItWG RDNjlHUA
                                          3d 3d 0d 0a 43 6f 6e 6e  65 63 74 69 6f 6e 3a 20 |==..Conn ection: 
                                          6b 65 65 70 2d 61 6c 69  76 65 0d 0a 0d 0a       |keep-ali ve....  
[00:00:44.987,762] <dbg> download_client: download_thread: Receiving up to 4096 bytes at 0x20011564...
[00:00:45.350,646] <dbg> download_client: download_thread: Read 525 bytes from socket
[00:00:45.350,769] <dbg> download_client: http_header_parse: GET header size: 525
[00:00:45.351,196] <dbg> download_client: download_thread: Receiving up to 4096 bytes at 0x20011564...
[00:00:45.859,649] <dbg> download_client: download_thread: Read 2048 bytes from socket
[00:00:45.859,649] <inf> download_client: Downloaded 8192/347875 bytes (2%)
[00:00:45.883,117] <dbg> download_client: http_get_request_send: HTTP request
                                          47 45 54 20 2f 69 6d 38  33 30 2f 61 70 70 5f 75 |GET /im8 30/app_u
                                          70 64 61 74 65 2e 62 69  6e 20 48 54 54 50 2f 31 |pdate.bi n HTTP/1
                                          2e 31 0d 0a 48 6f 73 74  3a 20 73 74 67 2d 6d 63 |.1..Host : stg-mc
                                          2d 72 65 70 6f 2e 6d 63  61 70 70 73 2e 6a 70 0d |-repo.mc apps.jp.
                                          0a 52 61 6e 67 65 3a 20  62 79 74 65 73 3d 38 31 |.Range:  bytes=81
                                          39 32 2d 31 30 32 33 39  0d 0a 41 75 74 68 6f 72 |92-10239 ..Author
                                          69 7a 61 74 69 6f 6e 3a  20 42 61 73 69 63 20 56 |ization:  Basic V
                                          45 35 52 59 6c 52 68 57  58 5a 6a 5a 53 31 6a 4f |E5RYlRhW XZjZS1jO
                                          6c 4e 43 59 58 49 74 57  47 52 44 4e 6a 6c 48 55 |lNCYXItW GRDNjlHU
                                          41 3d 3d 0d 0a 43 6f 6e  6e 65 63 74 69 6f 6e 3a |A==..Con nection:
                                          20 6b 65 65 70 2d 61 6c  69 76 65 0d 0a 0d 0a    | keep-al ive.... 
[00:00:45.883,880] <dbg> download_client: download_thread: Receiving up to 4096 bytes at 0x20011564...
[00:00:46.121,307] <wrn> download_client: Peer closed connection!
[00:00:46.121,337] <wrn> fota_download: Download socket error. 8 retries left...
[00:00:46.121,368] <inf> download_client: Reconnecting..
[00:00:46.131,439] <dbg> download_client: client_connect: Protocol not specified, defaulting to HTTP(S)
[00:00:46.131,469] <dbg> download_client: client_connect: Port not specified, using default: 443
[00:00:46.131,500] <dbg> download_client: client_connect: family: 1, type: 1, proto: 258
[00:00:46.131,866] <inf> download_client: Setting up TLS credentials, tag 42
[00:00:46.131,958] <inf> download_client: Configuring socket timeout (30 s)
[00:00:46.132,019] <inf> download_client: Connecting to mydomain.com
[00:00:46.132,049] <dbg> download_client: client_connect: fd 1, addrlen 8, fam IPv4, port 443
[00:00:46.968,719] <inf> cpu_load: Load:17,201%
[00:00:48.513,000] <dbg> download_client: http_get_request_send: HTTP request
                                          47 45 54 20 2f 69 6d 38  33 30 2f 61 70 70 5f 75 |GET /im8 30/app_u
                                          70 64 61 74 65 2e 62 69  6e 20 48 54 54 50 2f 31 |pdate.bi n HTTP/1
                                          2e 31 0d 0a 48 6f 73 74  3a 20 73 74 67 2d 6d 63 |.1..Host : stg-mc
                                          2d 72 65 70 6f 2e 6d 63  61 70 70 73 2e 6a 70 0d |-repo.mc apps.jp.
                                          0a 52 61 6e 67 65 3a 20  62 79 74 65 73 3d 38 31 |.Range:  bytes=81
                                          39 32 2d 31 30 32 33 39  0d 0a 41 75 74 68 6f 72 |92-10239 ..Author
                                          69 7a 61 74 69 6f 6e 3a  20 42 61 73 69 63 20 56 |ization:  Basic V
                                          45 35 52 59 6c 52 68 57  58 5a 6a 5a 53 31 6a 4f |E5RYlRhW XZjZS1jO
                                          6c 4e 43 59 58 49 74 57  47 52 44 4e 6a 6c 48 55 |lNCYXItW GRDNjlHU
                                          41 3d 3d 0d 0a 43 6f 6e  6e 65 63 74 69 6f 6e 3a |A==..Con nection:
                                          20 6b 65 65 70 2d 61 6c  69 76 65 0d 0a 0d 0a    | keep-al ive.... 
[00:00:48.513,854] <dbg> download_client: download_thread: Receiving up to 4096 bytes at 0x20011564...
[00:00:48.968,811] <inf> cpu_load: Load:8,967%
[00:00:48.977,111] <dbg> download_client: download_thread: Read 526 bytes from socket
[00:00:48.977,233] <dbg> download_client: http_header_parse: GET header size: 526
[00:00:48.977,661] <dbg> download_client: download_thread: Receiving up to 4096 bytes at 0x20011564...
[00:00:49.470,092] <dbg> download_client: download_thread: Read 2048 bytes from socket
[00:00:49.470,092] <inf> download_client: Downloaded 10240/347875 bytes (2%)
[00:00:49.579,528] <dbg> download_client: http_get_request_send: HTTP request
                                          47 45 54 20 2f 69 6d 38  33 30 2f 61 70 70 5f 75 |GET /im8 30/app_u
                                          70 64 61 74 65 2e 62 69  6e 20 48 54 54 50 2f 31 |pdate.bi n HTTP/1
                                          2e 31 0d 0a 48 6f 73 74  3a 20 73 74 67 2d 6d 63 |.1..Host : stg-mc
                                          2d 72 65 70 6f 2e 6d 63  61 70 70 73 2e 6a 70 0d |-repo.mc apps.jp.
                                          0a 52 61 6e 67 65 3a 20  62 79 74 65 73 3d 31 30 |.Range:  bytes=10
                                          32 34 30 2d 31 32 32 38  37 0d 0a 41 75 74 68 6f |240-1228 7..Autho
                                          72 69 7a 61 74 69 6f 6e  3a 20 42 61 73 69 63 20 |rization : Basic 
                                          56 45 35 52 59 6c 52 68  57 58 5a 6a 5a 53 31 6a |VE5RYlRh WXZjZS1j
                                          4f 6c 4e 43 59 58 49 74  57 47 52 44 4e 6a 6c 48 |OlNCYXIt WGRDNjlH
                                          55 41 3d 3d 0d 0a 43 6f  6e 6e 65 63 74 69 6f 6e |UA==..Co nnection
                                          3a 20 6b 65 65 70 2d 61  6c 69 76 65 0d 0a 0d 0a |: keep-a live....
[00:00:49.608,947] <dbg> download_client: download_thread: Receiving up to 4096 bytes at 0x20011564...
[00:00:49.892,211] <wrn> download_client: Peer closed connection!
[00:00:49.892,242] <wrn> fota_download: Download socket error. 7 retries left...
[00:00:49.892,242] <inf> download_client: Reconnecting..
[00:00:49.893,615] <dbg> download_client: client_connect: Protocol not specified, defaulting to HTTP(S)
[00:00:49.893,646] <dbg> download_client: client_connect: Port not specified, using default: 443
[00:00:49.893,676] <dbg> download_client: client_connect: family: 1, type: 1, proto: 258
[00:00:49.893,981] <inf> download_client: Setting up TLS credentials, tag 42
[00:00:49.894,073] <inf> download_client: Configuring socket timeout (30 s)
[00:00:49.894,134] <inf> download_client: Connecting to mydomain.com
[00:00:49.894,165] <dbg> download_client: client_connect: fd 1, addrlen 8, fam IPv4, port 443
[00:00:50.968,902] <inf> cpu_load: Load:15,321%
[00:00:52.265,014] <dbg> download_client: http_get_request_send: HTTP request
                                          47 45 54 20 2f 69 6d 38  33 30 2f 61 70 70 5f 75 |GET /im8 30/app_u
                                          70 64 61 74 65 2e 62 69  6e 20 48 54 54 50 2f 31 |pdate.bi n HTTP/1
                                          2e 31 0d 0a 48 6f 73 74  3a 20 73 74 67 2d 6d 63 |.1..Host : stg-mc
                                          2d 72 65 70 6f 2e 6d 63  61 70 70 73 2e 6a 70 0d |-repo.mc apps.jp.
                                          0a 52 61 6e 67 65 3a 20  62 79 74 65 73 3d 31 30 |.Range:  bytes=10
                                          32 34 30 2d 31 32 32 38  37 0d 0a 41 75 74 68 6f |240-1228 7..Autho
                                          72 69 7a 61 74 69 6f 6e  3a 20 42 61 73 69 63 20 |rization : Basic 
                                          56 45 35 52 59 6c 52 68  57 58 5a 6a 5a 53 31 6a |VE5RYlRh WXZjZS1j
                                          4f 6c 4e 43 59 58 49 74  57 47 52 44 4e 6a 6c 48 |OlNCYXIt WGRDNjlH
                                          55 41 3d 3d 0d 0a 43 6f  6e 6e 65 63 74 69 6f 6e |UA==..Co nnection
                                          3a 20 6b 65 65 70 2d 61  6c 69 76 65 0d 0a 0d 0a |: keep-a live....
[00:00:52.265,808] <dbg> download_client: download_thread: Receiving up to 4096 bytes at 0x20011564...
[00:00:52.707,763] <dbg> download_client: download_thread: Read 527 bytes from socket
[00:00:52.707,855] <dbg> download_client: http_header_parse: GET header size: 527
[00:00:52.708,343] <dbg> download_client: download_thread: Receiving up to 4096 bytes at 0x20011564...
[00:00:52.968,994] <inf> cpu_load: Load:8,894%
[00:00:53.204,315] <dbg> download_client: download_thread: Read 1024 bytes from socket
[00:00:53.204,345] <dbg> download_client: download_thread: Receiving up to 3072 bytes at 0x20011964...
[00:00:53.204,589] <dbg> download_client: download_thread: Read 1024 bytes from socket
[00:00:53.204,620] <inf> download_client: Downloaded 12288/347875 bytes (3%)
[00:00:53.261,505] <dbg> download_client: http_get_request_send: HTTP request
                                          47 45 54 20 2f 69 6d 38  33 30 2f 61 70 70 5f 75 |GET /im8 30/app_u
                                          70 64 61 74 65 2e 62 69  6e 20 48 54 54 50 2f 31 |pdate.bi n HTTP/1
                                          2e 31 0d 0a 48 6f 73 74  3a 20 73 74 67 2d 6d 63 |.1..Host : stg-mc
                                          2d 72 65 70 6f 2e 6d 63  61 70 70 73 2e 6a 70 0d |-repo.mc apps.jp.
                                          0a 52 61 6e 67 65 3a 20  62 79 74 65 73 3d 31 32 |.Range:  bytes=12
                                          32 38 38 2d 31 34 33 33  35 0d 0a 41 75 74 68 6f |288-1433 5..Autho
                                          72 69 7a 61 74 69 6f 6e  3a 20 42 61 73 69 63 20 |rization : Basic 
                                          56 45 35 52 59 6c 52 68  57 58 5a 6a 5a 53 31 6a |VE5RYlRh WXZjZS1j
                                          4f 6c 4e 43 59 58 49 74  57 47 52 44 4e 6a 6c 48 |OlNCYXIt WGRDNjlH
                                          55 41 3d 3d 0d 0a 43 6f  6e 6e 65 63 74 69 6f 6e |UA==..Co nnection
                                          3a 20 6b 65 65 70 2d 61  6c 69 76 65 0d 0a 0d 0a |: keep-a live....
[00:00:53.277,099] <dbg> download_client: download_thread: Receiving up to 4096 bytes at 0x20011564...
[00:00:53.581,787] <wrn> download_client: Peer closed connection!
[00:00:53.581,817] <wrn> fota_download: Download socket error. 6 retries left...
[00:00:53.581,817] <inf> download_client: Reconnecting..
[00:00:53.583,038] <dbg> download_client: client_connect: Protocol not specified, defaulting to HTTP(S)
[00:00:53.583,068] <dbg> download_client: client_connect: Port not specified, using default: 443
[00:00:53.583,068] <dbg> download_client: client_connect: family: 1, type: 1, proto: 258
[00:00:53.583,404] <inf> download_client: Setting up TLS credentials, tag 42
[00:00:53.583,496] <inf> download_client: Configuring socket timeout (30 s)
[00:00:53.583,557] <inf> download_client: Connecting to mydomain.com
[00:00:53.583,587] <dbg> download_client: client_connect: fd 1, addrlen 8, fam IPv4, port 443
[00:00:54.969,085] <inf> cpu_load: Load:12,853%
[00:00:56.104,370] <dbg> download_client: http_get_request_send: HTTP request
                                          47 45 54 20 2f 69 6d 38  33 30 2f 61 70 70 5f 75 |GET /im8 30/app_u
                                          70 64 61 74 65 2e 62 69  6e 20 48 54 54 50 2f 31 |pdate.bi n HTTP/1
                                          2e 31 0d 0a 48 6f 73 74  3a 20 73 74 67 2d 6d 63 |.1..Host : stg-mc
                                          2d 72 65 70 6f 2e 6d 63  61 70 70 73 2e 6a 70 0d |-repo.mc apps.jp.
                                          0a 52 61 6e 67 65 3a 20  62 79 74 65 73 3d 31 32 |.Range:  bytes=12
                                          32 38 38 2d 31 34 33 33  35 0d 0a 41 75 74 68 6f |288-1433 5..Autho
                                          72 69 7a 61 74 69 6f 6e  3a 20 42 61 73 69 63 20 |rization : Basic 
                                          56 45 35 52 59 6c 52 68  57 58 5a 6a 5a 53 31 6a |VE5RYlRh WXZjZS1j
                                          4f 6c 4e 43 59 58 49 74  57 47 52 44 4e 6a 6c 48 |OlNCYXIt WGRDNjlH
                                          55 41 3d 3d 0d 0a 43 6f  6e 6e 65 63 74 69 6f 6e |UA==..Co nnection
                                          3a 20 6b 65 65 70 2d 61  6c 69 76 65 0d 0a 0d 0a |: keep-a live....
[00:00:56.105,194] <dbg> download_client: download_thread: Receiving up to 4096 bytes at 0x20011564...
[00:00:56.406,585] <dbg> download_client: download_thread: Read 527 bytes from socket
[00:00:56.406,677] <dbg> download_client: http_header_parse: GET header size: 527
[00:00:56.407,135] <dbg> download_client: download_thread: Receiving up to 4096 bytes at 0x20011564...
[00:00:56.943,511] <dbg> download_client: download_thread: Read 1024 bytes from socket
[00:00:56.943,542] <dbg> download_client: download_thread: Receiving up to 3072 bytes at 0x20011964...
[00:00:56.943,786] <dbg> download_client: download_thread: Read 1024 bytes from socket
[00:00:56.943,786] <inf> download_client: Downloaded 14336/347875 bytes (4%)
[00:00:57.029,510] <inf> cpu_load: Load:15,122%
[00:00:57.108,734] <dbg> download_client: http_get_request_send: HTTP request
                                          47 45 54 20 2f 69 6d 38  33 30 2f 61 70 70 5f 75 |GET /im8 30/app_u
                                          70 64 61 74 65 2e 62 69  6e 20 48 54 54 50 2f 31 |pdate.bi n HTTP/1
                                          2e 31 0d 0a 48 6f 73 74  3a 20 73 74 67 2d 6d 63 |.1..Host : stg-mc
                                          2d 72 65 70 6f 2e 6d 63  61 70 70 73 2e 6a 70 0d |-repo.mc apps.jp.
                                          0a 52 61 6e 67 65 3a 20  62 79 74 65 73 3d 31 34 |.Range:  bytes=14
                                          33 33 36 2d 31 36 33 38  33 0d 0a 41 75 74 68 6f |336-1638 3..Autho
                                          72 69 7a 61 74 69 6f 6e  3a 20 42 61 73 69 63 20 |rization : Basic 
                                          56 45 35 52 59 6c 52 68  57 58 5a 6a 5a 53 31 6a |VE5RYlRh WXZjZS1j
                                          4f 6c 4e 43 59 58 49 74  57 47 52 44 4e 6a 6c 48 |OlNCYXIt WGRDNjlH
                                          55 41 3d 3d 0d 0a 43 6f  6e 6e 65 63 74 69 6f 6e |UA==..Co nnection
                                          3a 20 6b 65 65 70 2d 61  6c 69 76 65 0d 0a 0d 0a |: keep-a live....
[00:00:57.126,556] <dbg> download_client: download_thread: Receiving up to 4096 bytes at 0x20011564...
[00:00:57.466,827] <wrn> download_client: Peer closed connection!
[00:00:57.466,857] <wrn> fota_download: Download socket error. 5 retries left...
[00:00:57.466,857] <inf> download_client: Reconnecting..
[00:00:57.468,109] <dbg> download_client: client_connect: Protocol not specified, defaulting to HTTP(S)
[00:00:57.468,139] <dbg> download_client: client_connect: Port not specified, using default: 443
[00:00:57.468,139] <dbg> download_client: client_connect: family: 1, type: 1, proto: 258
[00:00:57.468,475] <inf> download_client: Setting up TLS credentials, tag 42
[00:00:57.468,566] <inf> download_client: Configuring socket timeout (30 s)
[00:00:57.468,627] <inf> download_client: Connecting to mydomain.com
[00:00:57.468,658] <dbg> download_client: client_connect: fd 1, addrlen 8, fam IPv4, port 443
[00:00:59.029,663] <inf> cpu_load: Load:14,131%
[00:00:59.864,379] <dbg> download_client: http_get_request_send: HTTP request
                                          47 45 54 20 2f 69 6d 38  33 30 2f 61 70 70 5f 75 |GET /im8 30/app_u
                                          70 64 61 74 65 2e 62 69  6e 20 48 54 54 50 2f 31 |pdate.bi n HTTP/1
                                          2e 31 0d 0a 48 6f 73 74  3a 20 73 74 67 2d 6d 63 |.1..Host : stg-mc
                                          2d 72 65 70 6f 2e 6d 63  61 70 70 73 2e 6a 70 0d |-repo.mc apps.jp.
                                          0a 52 61 6e 67 65 3a 20  62 79 74 65 73 3d 31 34 |.Range:  bytes=14
                                          33 33 36 2d 31 36 33 38  33 0d 0a 41 75 74 68 6f |336-1638 3..Autho
                                          72 69 7a 61 74 69 6f 6e  3a 20 42 61 73 69 63 20 |rization : Basic 
                                          56 45 35 52 59 6c 52 68  57 58 5a 6a 5a 53 31 6a |VE5RYlRh WXZjZS1j
                                          4f 6c 4e 43 59 58 49 74  57 47 52 44 4e 6a 6c 48 |OlNCYXIt WGRDNjlH
                                          55 41 3d 3d 0d 0a 43 6f  6e 6e 65 63 74 69 6f 6e |UA==..Co nnection
                                          3a 20 6b 65 65 70 2d 61  6c 69 76 65 0d 0a 0d 0a |: keep-a live....
[00:00:59.865,295] <dbg> download_client: download_thread: Receiving up to 4096 bytes at 0x20011564...
[00:01:00.308,044] <dbg> download_client: download_thread: Read 527 bytes from socket
[00:01:00.308,166] <dbg> download_client: http_header_parse: GET header size: 527
[00:01:00.308,593] <dbg> download_client: download_thread: Receiving up to 4096 bytes at 0x20011564...
[00:01:00.802,551] <dbg> download_client: download_thread: Read 1024 bytes from socket
[00:01:00.802,581] <dbg> download_client: download_thread: Receiving up to 3072 bytes at 0x20011964...
[00:01:00.802,825] <dbg> download_client: download_thread: Read 1024 bytes from socket
[00:01:00.802,825] <inf> download_client: Downloaded 16384/347875 bytes (4%)
[00:01:00.857,269] <dbg> download_client: http_get_request_send: HTTP request
                                          47 45 54 20 2f 69 6d 38  33 30 2f 61 70 70 5f 75 |GET /im8 30/app_u
                                          70 64 61 74 65 2e 62 69  6e 20 48 54 54 50 2f 31 |pdate.bi n HTTP/1
                                          2e 31 0d 0a 48 6f 73 74  3a 20 73 74 67 2d 6d 63 |.1..Host : stg-mc
                                          2d 72 65 70 6f 2e 6d 63  61 70 70 73 2e 6a 70 0d |-repo.mc apps.jp.
                                          0a 52 61 6e 67 65 3a 20  62 79 74 65 73 3d 31 36 |.Range:  bytes=16
                                          33 38 34 2d 31 38 34 33  31 0d 0a 41 75 74 68 6f |384-1843 1..Autho
                                          72 69 7a 61 74 69 6f 6e  3a 20 42 61 73 69 63 20 |rization : Basic 
                                          56 45 35 52 59 6c 52 68  57 58 5a 6a 5a 53 31 6a |VE5RYlRh WXZjZS1j
                                          4f 6c 4e 43 59 58 49 74  57 47 52 44 4e 6a 6c 48 |OlNCYXIt WGRDNjlH
                                          55 41 3d 3d 0d 0a 43 6f  6e 6e 65 63 74 69 6f 6e |UA==..Co nnection
                                          3a 20 6b 65 65 70 2d 61  6c 69 76 65 0d 0a 0d 0a |: keep-a live....
[00:01:00.858,276] <dbg> download_client: download_thread: Receiving up to 4096 bytes at 0x20011564...
[00:01:01.029,754] <inf> cpu_load: Load:11,524%
[00:01:01.184,417] <wrn> download_client: Peer closed connection!
[00:01:01.184,448] <wrn> fota_download: Download socket error. 4 retries left...
[00:01:01.184,448] <inf> download_client: Reconnecting..
[00:01:01.185,760] <dbg> download_client: client_connect: Protocol not specified, defaulting to HTTP(S)
[00:01:01.185,791] <dbg> download_client: client_connect: Port not specified, using default: 443
[00:01:01.185,791] <dbg> download_client: client_connect: family: 1, type: 1, proto: 258
[00:01:01.186,157] <inf> download_client: Setting up TLS credentials, tag 42
[00:01:01.186,248] <inf> download_client: Configuring socket timeout (30 s)
[00:01:01.186,279] <inf> download_client: Connecting to mydomain.com
[00:01:01.186,309] <dbg> download_client: client_connect: fd 1, addrlen 8, fam IPv4, port 443


I have modified v1.9.1\nrf\subsys\net\lib\download_client\src\http.c

for basic HTTP authentication in HTTP header.


/* Request a range of bytes; use with HTTPS due to modem limitations */
#define HTTP_GET_RANGE                                                         \
	"GET /%s HTTP/1.1\r\n"                                                 \
	"Host: %s\r\n"                                                         \
	"Range: bytes=%u-%u\r\n"                                               \
	"Authorization: Basic VE5RYlRhWXZjZS1jOlNCYXItWGRDNjlHUA==\r\n"				 \	
	"Connection: keep-alive\r\n"                                           \
	"\r\n"


I could not figure out why I am getting download_client: Peer closed connection! warning and download could not complete.

I also tried increase http fragment size to

CONFIG_DOWNLOAD_CLIENT_HTTP_FRAG_SIZE_2048=y


it could not helped me.

Please help me in investing the issue.


Best Regards


Praveen Deshmane



Related