dart-lang / dart-lang/http

SocketException after long time POST

Open
#262 14 comments 39 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
1.1k
Forks
419
Avg merge
4d 14h
Merged PRs (30d)
8

Description

If i make a long time post with MultipartRequest class i get a SocketException after 70 seconds
Setting timeouts have no effect.

**Exception:**
SocketException: OS Error: Software caused connection abort, errno = 103, address = 192.168.1.1, port = 54136

**Codesnippet:**

```
final Uri url = ......
MultipartRequest request = new MultipartRequest("POST", url);
Uint8List data = .......

Map headers = {
"Content-Type": "multipart/form-data",
"Expect": "100-continue",
"Accept": "*/*"
};

final MultipartFile multipartFile = MultipartFile.fromBytes("firmware", data);
request.headers.addAll(headers);
request.files.add(multipartFile);

try {
return await request.send();
} catch (error) {
print(error.toString());
}
```

**The POST with curl is successful.**

```
$ curl -v -F filenmae=@filexyz http://192.168.1.1/upload.cgi
* Trying 192.168.1.1...
* TCP_NODELAY set
* Connected to 192.168.1.1 (192.168.1.1) port 80 (#0)
> POST /upload.cgi HTTP/1.1
> Host: 192.168.1.1
> User-Agent: curl/7.61.1
> Accept: */*
> Content-Length: 7602006
> Content-Type: multipart/form-data; boundary=------------------------db58954d11f68cd8
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
< Server: xyz/0.0.8
< Content-Length: 0
< Connection: keep-alive
* Done waiting for 100-continue
< HTTP/1.1 102 Processing
< Server: xyz/0.0.8
< Content-Length: 0
< Connection: keep-alive
< HTTP/1.1 201 Created
< Server: xyz/0.0.8
< Content-Length: 0
< Connection: close
* Closing connection 0
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.