Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions bitswap/network/httpnet/httpnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,12 @@ func New(host host.Host, opts ...Option) network.BitSwapNetwork {

c := &http.Client{
Transport: t,
CheckRedirect: func(req *http.Request, via []*http.Request) error {
// we do not follow redirects. Providers should keep
// announcements up to
// date. https://github.com/boxo/issues/862.
return http.ErrUseLastResponse
Comment thread
hsanjuan marked this conversation as resolved.
},
}
htnet.client = c

Expand Down
7 changes: 6 additions & 1 deletion bitswap/network/httpnet/msg_sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,12 @@ func (sender *httpMsgSender) tryURL(ctx context.Context, u *senderURL, entry bsm
case http.StatusNotFound,
http.StatusGone,
http.StatusForbidden,
http.StatusUnavailableForLegalReasons:
http.StatusUnavailableForLegalReasons,
http.StatusMovedPermanently,
http.StatusFound,
http.StatusSeeOther,
http.StatusTemporaryRedirect,
http.StatusPermanentRedirect:

err := fmt.Errorf("%s %q -> %d: %q", req.Method, req.URL, statusCode, string(body))
log.Debug(err)
Expand Down