Skip to content
This repository was archived by the owner on Oct 5, 2023. It is now read-only.

adds authenticated transport and non-standard api path connections #15

Merged
merged 9 commits into from
May 2, 2019

Conversation

bonedaddy
Copy link

@bonedaddy bonedaddy commented Apr 10, 2019

This PR adds the ability to use go-ipfs-http-client with an endpoint expecting authorization, ie via JWT's. Additionally, it allows connection go-ipfs-http-client to an endpoint that may not be using a standard path, ie /foo/bar/api/v0 as opposed to /api/v0.

Currently multiaddr doesn't support parsing of http paths, which is what NewDirectAPIClient works around. Initially I thought NewApiWithClient might be usable instead, however since it expects a multiaddr and the multiaddr spec doesn't currently support parsing of http paths, this is needed.

edit: Not quite sure why the travis build is failing, but it seems to be some kind of go version check when this part of the build runs (cd $GOPATH/src/github.com/ipfs/go-ipfs; make install)

@Stebalien Stebalien requested a review from magik6k April 26, 2019 01:52
Copy link
Member

@magik6k magik6k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few minor nits, looks good in general, Thanks!

@bonedaddy
Copy link
Author

bonedaddy commented May 2, 2019

Not quite sure why this error is happening however I've traced the line of code causing it to

contentType, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type"))

update: Actually I was being a bit dump, the reason why its happening with this test, is because the test server isn't setting Content-Type header in the response. Additionally the conditional to check the header was improperly specified.

Copy link
Member

@magik6k magik6k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I'll let @Stebalien have one last look

@magik6k magik6k requested a review from Stebalien May 2, 2019 00:27
@bonedaddy
Copy link
Author

bonedaddy commented May 2, 2019

I believe I forgot to commit removal of the file transport.go, currently out of the house but can commit that when I get back home.

edit: I have pushed a commit to remove the transport.go file.

@magik6k
Copy link
Member

magik6k commented May 2, 2019

@Stebalien lgtm-ed on IRC

@magik6k magik6k merged commit b9c8a2f into ipfs:master May 2, 2019
Jorropo pushed a commit to ipfs/kubo that referenced this pull request May 30, 2023
…auth

adds authenticated transport and non-standard api path connections

This commit was moved from ipfs/go-ipfs-http-client@b9c8a2f
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants