ipfs / ipfs/kubo

Connection reuse failure when go-ipfs node called from Swift API client.

Open
#3,767 8 comments 1 reaction 0 assignees View on GitHub
topic/api
Dominant language
Go
Stars
17.1k
Forks
3.2k
Avg merge
3d 18h
Merged PRs (30d)
11

Description

#### Version information:
go-ipfs version: 0.4.6-dev-
Repo version: 5
System version: amd64/darwin
Golang version: go1.7

#### Type:
Bug

#### Priority:
P4

#### Description:
On @whyrusleeping’s suggestion I’m opening this issue which may involve the go-ipfs node not dealing properly with connection reuse.

The problem manifests as an `X-Stream-Error` response and a trailer with the error `X-Stream-Error: multipart: Part Read: http: invalid Read on closed Body`. The full exchange is shown in the following [gist](https://gist.github.com/NeoTeo/08b49de8a2893c3fd2befb2deb5b5f08) (ascii and hex dump).
The exchange is between the [swift-ipfs-api](https://github.com/ipfs/swift-ipfs-api) and a localhost go-ipfs node.

The standard Cocoa frameworks recommended for URL connections do not allow for setting the http header field `connection: close` (see section on reserved HTTP Headers [here](https://developer.apple.com/reference/foundation/nsmutableurlrequest)) which means they are sent with `connection: keep-alive`. This (probably?) causes the ipfs node to reuse the connection and not always succeeding (sometimes it works, sometimes it partially works and other times it just fails).

The issue is whether the ipfs node is/should be able to properly handle connection reuse or whether Cocoa (mac & iOS) API clients need to force a `connection: close` on the headers by using a more low-level approach.

let me know if you need any more info.

:) Teo

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.