-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Set .metadata
suffix on URL path
#2123
Conversation
@hmc-cs-mdrissi -- are you interested in testing this branch? |
@pradyunsg -- sorry to bother, it was pointed out to me that |
Yes I am happy to. First time building rust codebase and fairly smooth experience. It sadly failed though, Verbose Logs
|
Thank you! That's a bummer. So it's an identical URL to what pip is requesting, right? My only remaining guess then is that we're losing the auth somewhere, and the server is responding with a 404. |
Yes the url is identical to pip based on breakpointing. Auth headers is my best guess and the headers being used for some requests (index fetch vs wheel fetch) are inconsistent. I see pip has PipSession object that manages auth and the wheel fetch does store the needed authentication tokens. |
If we could log the headers in error message used along with url I can compare exact headers pip uses vs uv. edit: Here's pip's headers
I'm assuming authorization being key piece. The authorization header is same for both pip's wheel request and index request. edit 2: Error message is also same as with fragment. So it's possible that fragment being present was a red herring for my index server and only auth headers is the issue. May still be worth for pip compatibility excluding the fragment. |
Are the two URLs (for index fetch vs. wheel fetch) on different domains, or do they use different schemes, or anything like that? |
The first url is,
The second url is,
So the url is exact same. I may take a look tomorrow at uv closer, just not confident as it'll be my first time reading rust code and figuring out how to use a rust debugger. edit: The index url if it helps looks like,
|
Okay, thanks. And how do you typically provide the credentials? (We have this |
The credentials are contained within the index-url. Not sure you saw the edit I made to show the index url. |
Okay cool, yeah, I would expect this to work. I can push a branch that adds more logging for the headers and such tomorrow if you'd like. Would love to get this working for you since if you're running into this issue, I'm sure you won't be the only one. |
A few other things is I am able to successfully curl the wheel fetch url with a simple command like,
So I think the only important thing is header being used and that index fetching successfully finding latest version feels like a sign that uv has the right authorization header for first fetch. The pip authorization header looks same as one in that curl command. edit: More logging would be very helpful and will definitely try it. |
@hmc-cs-mdrissi - What kind of logging would be most useful? Like, all headers? |
Yes headers for each request sent. Most important two requests being index fetch + wheel fetch. Alternatively if you could point me to the code where these requests are sent I could try to do some print debugging |
I just saw this. I don't think it's written in any packaging spec but I'm pretty sure the hash fragment has to be dropped when querying the server since that's how URLs work? The fragment part is usually meant to reference something within the resource, eg anchors on HTML pages, and isn't sent to the server. From https://url.spec.whatwg.org/#concept-url-fragment:
I don't think I've ever seen someone send an HTTP request with # fragment in the path segment, and I'm pretty sure it'll fail for most servers. I'm actually surprised if PyPI actually responds to a malformed request like that, if that is indeed what y'all are doing. |
Honestly very possible that |
Ah, yea, that makes sense! It would be a bit of a surprise if it wasn't. 😅 |
5143869
to
a49d4ef
Compare
Merging a minimal version of this that just fixes one erroneous site. |
.metadata
suffix on URL path
@hmc-cs-mdrissi -- Merging but I don't expect this to fix the problem here -- let's continue in the linked issue. |
Summary
Ensures that we don't add the
.metadata
suffix after the fragment, if it exists.