dart-lang / dart-lang/http

MultipartRequest on redirect gives confusing error

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

Description

Failure case:

1. create a `MultipartRequest` (with default `followRedirects` setting)
2. server processes the request and returns `303` response.
3. `MultipartRequest.send()` throws:
```
SocketException: OS Error: Connection refused, errno = 61, address = localhost, port = 63122
closing 63114
dart:_http _HttpClient.openUrl
package:http/src/io_client.dart 31:37 IOClient.send
```

Based on the exception I thought that this is a network/firewall/port issue, but turns out if I set `followRedirects = false` I'll get a normal `Response`.

When `MultipartRequest.send()` follows the redirect and fails for some reason, it should throw an appropriate exception instead of the confusing one above.

Contributor guide

Open the contributing guide

Research direction

Start at MultipartRequest.send() and reproduce the listed 303 redirect case with the default followRedirects setting, then compare it with followRedirects = false. Trace the redirect failure through the HTTP client and define a clearer exception for this scenario; done means the failure no longer presents the misleading connection error while the normal response path remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.