git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 4/5] bundle-uri: add support for http(s):// and file://

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 4, 2022, 18:19 UTC
Message-ID
<xmqqsfmb50s0.fsf@gitster.g>
In-Reply-To
<9afd5eb2-44a0-6342-6006-5dbdefba9947@github.com>
Derrick Stolee <derrickstolee@github.com> writes:
Show 8 quoted lines
>>> +	if (istarts_with(uri, "https:") ||
>>> +	    istarts_with(uri, "http:"))
>> 
>> Let's be a bit more strict to avoid mistakes and make the code
>> immediately obvious, e.g.
>> 
>> 	if (istarts_with(uri, "https://") ||
>> 	    istarts_with(uri, "http://"))

This part (i.e. check for "<scheme>://", not "<scheme>:") still stands, as the latter could be an scp style Git URL that goes to the host whose name is <scheme>. As mentioned later, s/istarts/starts/ is probably a good thing to do here.

Show 12 quoted lines
>> Does "git-remote-https" talk to a "http://" URL just fine when uri
>> parameter starts with "http://"?  Would it be the same if the uri
>> parameter begins with say "Http://"?
>
> I did a quick check of our HTTPS tests modifying the HTTPD_PROTO
> variable in lib-httpd.sh to "HtTP" and we get this fun error:
>
> + git clone --filter=blob:limit=0 HtTP://127.0.0.1:5601/smart/server client
> Cloning into 'client'...
> git: 'remote-HtTP' is not a git command. See 'git --help'.
>
> So I guess I can keep case-sensitive comparisons here.

Guarding them to lowercase-only may sound like a cop-out to purists, but I think it is reasonable thing to do. The only folks that would be offended by are protocol lawyers, and as your check shows, we are treating <scheme> case sensitively already.

An obvious alternative is to downcase the "<scheme>://" part but I do not think it is worth it; we have to do that everywhere and we need to be confident that we covered all the code paths---the latter is expensive.

There do exist skip_iprefix() that are used in many places, like convert, http, mailinfo, etc. by the way. That is a moot point as we are not doing case insensitive comparison anymore.

Thanks.
Previous: Derrick StoleeNext: Derrick Stolee via GitGitGadget
Message 24 of 36 in “Bundle URIs II: git clone --bundle-uri”
  1. 0/5 Bundle URIs II: git clone --bundle-uriDerrick Stolee via GitGitGadget, Jul 25, 2022
  2. 1/5 remote-curl: add 'get' capabilityDerrick Stolee via GitGitGadget, Jul 25, 2022
  3. Josh SteadmonJul 27, 2022
  4. Ævar Arnfjörð BjarmasonJul 27, 2022
  5. Derrick StoleeAug 1, 2022
  6. Ævar Arnfjörð BjarmasonAug 1, 2022
  7. 2/5 bundle-uri: create basic file-copy logicDerrick Stolee via GitGitGadget, Jul 25, 2022
  8. Josh SteadmonJul 27, 2022
  9. Derrick StoleeAug 1, 2022
  10. 3/5 clone: add --bundle-uri optionDerrick Stolee via GitGitGadget, Jul 25, 2022
  11. 5/5 clone: --bundle-uri cannot be combined with --depthDerrick Stolee via GitGitGadget, Jul 25, 2022
  12. 4/5 bundle-uri: add support for http(s):// and file://Derrick Stolee via GitGitGadget, Jul 25, 2022
  13. Josh SteadmonJul 27, 2022
  14. Derrick StoleeAug 1, 2022
  15. Josh SteadmonJul 27, 2022
  16. Derrick StoleeAug 1, 2022
  17. 0/5 Bundle URIs II: git clone --bundle-uriDerrick Stolee via GitGitGadget, Aug 2, 2022
  18. 1/5 remote-curl: add 'get' capabilityDerrick Stolee via GitGitGadget, Aug 2, 2022
  19. 2/5 bundle-uri: create basic file-copy logicDerrick Stolee via GitGitGadget, Aug 2, 2022
  20. 3/5 clone: add --bundle-uri optionDerrick Stolee via GitGitGadget, Aug 2, 2022
  21. 4/5 bundle-uri: add support for http(s):// and file://Derrick Stolee via GitGitGadget, Aug 2, 2022
  22. Junio C HamanoAug 2, 2022
  23. Derrick StoleeAug 4, 2022
  24. Junio C HamanoAug 4, 2022
  25. 5/5 clone: --bundle-uri cannot be combined with --depthDerrick Stolee via GitGitGadget, Aug 2, 2022
  26. 0/5 Bundle URIs II: git clone --bundle-uriDerrick Stolee via GitGitGadget, Aug 9, 2022
  27. 1/5 remote-curl: add 'get' capabilityDerrick Stolee via GitGitGadget, Aug 9, 2022
  28. 2/5 bundle-uri: create basic file-copy logicDerrick Stolee via GitGitGadget, Aug 9, 2022
  29. 3/5 clone: add --bundle-uri optionDerrick Stolee via GitGitGadget, Aug 9, 2022
  30. Junio C HamanoAug 22, 2022
  31. Derrick StoleeAug 23, 2022
  32. Junio C HamanoAug 24, 2022
  33. 4/5 bundle-uri: add support for http(s):// and file://Derrick Stolee via GitGitGadget, Aug 9, 2022
  34. 4/5 bundle-uri: add support for http(s):// and file://Teng Long, Aug 29, 2022
  35. Derrick StoleeAug 30, 2022
  36. 5/5 clone: --bundle-uri cannot be combined with --depthDerrick Stolee via GitGitGadget, Aug 9, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.