ipfs / ipfs/gateway-conformance

bug: location header absolute/relative specificity

Open
#233 2 comments 0 reactions 0 assignees View on GitHub
help wanted P2
Dominant language
Go
Stars
19
Forks
15
Avg merge
1d 4h
Merged PRs (30d)
5

Description

I don't think the conformance testing suite should care about whether a redirect is using an absolute or relative URI, but maybe I am missing something.

Basically, [verified-fetch](https://github.com/ipfs/helia-verified-fetch) is redirecting to an absolute URI, and the host of the absolute URI matches the host of the requested resource, so we could return a relative reference, but I don't think we should need to.

See https://httpwg.org/specs/rfc9110.html#field.location

```
=== RUN TestUnixFSDirectoryListingOnSubdomainGateway/redirect_dir_listing_to_URL_with_trailing_slash/Header_Location

run.go:58:
Name: redirect dir listing to URL with trailing slash
Hint:

Error: Header 'Location' expected '/%!c(MISSING)4%!/(MISSING)%!c(MISSING)4%!/(MISSING)', got 'http://bafybeig6ka5mlwkl4subqhaiatalkcleo4jgnr3hqwvpmsqfca27cijp3i.ipfs.localhost:3441/%!C(MISSING)4%!/(MISSING)%!C(MISSING)4%!/(MISSING)'

Expected Request:
{
"method": "GET",
"path": "/ą/ę",
"headers": {
"Host": "bafybeig6ka5mlwkl4subqhaiatalkcleo4jgnr3hqwvpmsqfca27cijp3i.ipfs.localhost:3441"
}
}

Actual Request:
GET /%C4%85/%C4%99 HTTP/1.1
Host: bafybeig6ka5mlwkl4subqhaiatalkcleo4jgnr3hqwvpmsqfca27cijp3i.ipfs.localhost:3441
User-Agent: ipfs/gateway-conformance/dev
Accept-Encoding: gzip



Expected Response:
{
"statusCode": 301,
"headers": [
{
"key": "Location",
"check": {}
}
]
}

Actual Response:
HTTP/1.1 301 Moved Permanently
Transfer-Encoding: chunked
Cache-Control: public, max-age=29030400, immutable
Connection: keep-alive
Date: Tue, 04 Feb 2025 19:10:08 GMT
Etag: "bafybeig6ka5mlwkl4subqhaiatalkcleo4jgnr3hqwvpmsqfca27cijp3i"
Keep-Alive: timeout=5
Location: http://bafybeig6ka5mlwkl4subqhaiatalkcleo4jgnr3hqwvpmsqfca27cijp3i.ipfs.localhost:3441/%C4%85/%C4%99/
X-Ipfs-Path: /ipfs/bafybeig6ka5mlwkl4subqhaiatalkcleo4jgnr3hqwvpmsqfca27cijp3i/%C4%85/%C4%99



--- FAIL: TestUnixFSDirectoryListingOnSubdomainGateway/redirect_dir_listing_to_URL_with_trailing_slash/Header_Location (0.00s)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.