-
Notifications
You must be signed in to change notification settings - Fork 69
Implement HTTP(s) support #468
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
Conversation
We shouldn't call this "anchor". Anchor has a different meaning in a close enough context that I think this will be confusing. In particular, "anchor" colloquially refers to "anchor tags" in HTML documents, which you can reference within a URL with fragment identifiers
I'm not sure I like this. There are often genuine files that don't have file extensions that are usually plain text files, e.g., My impression is that, (while it's not absolute) the most common convention and default for many web servers and frameworks is to use a trailing slash explicitly to serve directories. |
Hm, yeah, I can see this is potentially confusing, but we're not calling it "anchor" arbitrarily. We're looking for the right analogy to populate the existing
Yeah, this was the other default rule I considered—I think you're right it's probably a more reliable default. That is how the python server works (except for the root, which does not redirect to the slash). Also planning for the method to be overridable so people can configure for their particular servers if it is different. |
|
So one thing to be aware of is your code assumes no one would ever do
|
@MattOates I guess I was thinking that this just sticks around on that path and any paths derived from it (since we don't mess with netloc) and should "just work." Does it not? Maybe there are just some bugs to clean up (sorry, haven't had a chance to poke at it and confirm/deny).
I think that we could (1) support env vars for basic auth like most of the cloud providers have for auth, (2) point people towards how to set the default client, or (3) recommend an explicit client. |
Does that mean we're going to print out the username and password in plaintext in string representations? |
Yeah, FWIW urllib also is happy to just print that out too. We could be more conservative, but I'm not inclined to add a special case if the standard lib doesn't. In [1]: from urllib.parse import urlparse
In [2]: urlparse("http://user:[email protected]")
Out[3]: ParseResult(scheme='http', netloc='user:[email protected]', path='', params='', query='', fragment='') |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #468 +/- ##
========================================
+ Coverage 93.4% 93.8% +0.3%
========================================
Files 23 26 +3
Lines 1800 1948 +148
========================================
+ Hits 1682 1828 +146
- Misses 118 120 +2
🚀 New features to boost your workflow:
|
|
Code review comments addressed and everything passing. Merging in HTTP support! 💖 |
Initial pass at http.
http.serverhttp.serverand also looks like it should work for apache and nginx file servers from my googling. (allows user to override this method for their own server).anchorinstead of.cloud_prefixwhere appropriate. For cloud providers,.anchoris the same as.cloud_prefix(e.g.,s3://). For http, the anchor should be the serverhttp://example.comand the.cloud_prefixshould behttp://. Constructing new paths should use.anchorLimitations/caveats:
Assumes that url must have suffix (e.g.,http://example.com/file.txt) to be a file; if no suffix, assumes dir. This is definitely not true of real-world URLs, but maybe is an ok assumption for anything serving files?/to be directories (user can pass custom test for urls if they have a different scenario)Left to do:
httpsCloses #455