Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repo gc in ipfs proxy #961

Merged
merged 8 commits into from Dec 6, 2019
Merged

repo gc in ipfs proxy #961

merged 8 commits into from Dec 6, 2019

Conversation

kishansagathiya
Copy link
Contributor

No description provided.

api/ipfsproxy/ipfsproxy.go Outdated Show resolved Hide resolved
api/ipfsproxy/ipfsproxy.go Outdated Show resolved Hide resolved
api/ipfsproxy/ipfsproxy.go Show resolved Hide resolved
Kishan Mohanbhai Sagathiya added 2 commits November 25, 2019 18:23
@kishansagathiya
Copy link
Contributor Author

Looking at https://github.com/ipfs/go-ipfs-cmds/blob/master/http/responseemitter.go
all responses would have these headers

< Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output, X-Content-Length
< Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output, X-Content-Length
< Trailer: X-Stream-Error

worth adding these in proxy responses as well?

Copy link
Collaborator

@hsanjuan hsanjuan left a comment

Choose a reason for hiding this comment

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

A test for stream-errors=false checking that the Trailer is set correctly is missing.


proxy.setHeaders(w.Header(), r)

w.Header().Set("Trailer", "X-Stream-Error")
Copy link
Collaborator

Choose a reason for hiding this comment

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

We will need to add this to the add handler, I think. It's a bug (new PR).

Copy link
Collaborator

Choose a reason for hiding this comment

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

Worth adding to all requests.

@@ -692,6 +701,11 @@ func (proxy *Server) repoGCHandler(w http.ResponseWriter, r *http.Request) {
}
}
}

if !streamErrors && len(errs) != 0 {
w.Header().Set("X-Stream-Error", ipfsrepo.NewMultiError(errs...).Error())
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should not require all go-ipfs module to re-use a tiny method. Cluster should not depend on go-ipfs.

@kishansagathiya
Copy link
Contributor Author

Seems like you can't check names of Trailers in w.Header() like every other headers.

Copy link
Collaborator

@hsanjuan hsanjuan left a comment

Choose a reason for hiding this comment

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

Seems like you can't check names of Trailers in w.Header() like every other headers.

I'm not sure, is this a problem here?

api/ipfsproxy/ipfsproxy.go Outdated Show resolved Hide resolved
@kishansagathiya
Copy link
Contributor Author

I'm not sure, is this a problem here?

Nope, It is not a problem. You can check if trailer header was set by checking response.Trailer

Kishan Mohanbhai Sagathiya added 2 commits December 6, 2019 12:17
@hsanjuan hsanjuan merged commit e1faf12 into master Dec 6, 2019
@hsanjuan hsanjuan deleted the task/repogc-proxy branch December 6, 2019 12:08
@hsanjuan
Copy link
Collaborator

hsanjuan commented Dec 6, 2019

@hsanjuan hsanjuan mentioned this pull request Dec 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants