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

bug: location header absolute/relative specificity #233

Open
SgtPooki opened this issue Feb 4, 2025 · 1 comment
Open

bug: location header absolute/relative specificity #233

SgtPooki opened this issue Feb 4, 2025 · 1 comment

Comments

@SgtPooki
Copy link
Member

SgtPooki commented Feb 4, 2025

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 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)
@SgtPooki
Copy link
Member Author

SgtPooki commented Feb 4, 2025

Note that I quickly modified verified-fetch to return redirects to relative urls and i'm still getting an error for this test:

�=== 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 '/%!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:22:36 GMT
        Etag: "bafybeig6ka5mlwkl4subqhaiatalkcleo4jgnr3hqwvpmsqfca27cijp3i"
        Keep-Alive: timeout=5
        Location: /%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)

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

No branches or pull requests

1 participant