path: root/url.c
AgeCommit message (Collapse)Author
2014-07-10use strbuf_addch for adding single charactersRené Scharfe
Signed-off-by: Rene Scharfe <> Signed-off-by: Junio C Hamano <>
2011-10-18Merge branch 'jk/http-auth'Junio C Hamano
* jk/http-auth: http_init: accept separate URL parameter http: use hostname in credential description http: retry authentication failures for all http requests remote-curl: don't retry auth failures with dumb protocol improve httpd auth tests url: decode buffers that are not NUL-terminated
2011-10-14Merge branch 'jc/is-url-simplify'Junio C Hamano
* jc/is-url-simplify: url.c: simplify is_url()
2011-10-03url.c: simplify is_url()Junio C Hamano
The function was implemented in an overly complicated way. Rewrite it to check from left to right in a single pass. Signed-off-by: Junio C Hamano <>
2011-07-20url: decode buffers that are not NUL-terminatedJeff King
The url_decode function needs only minor tweaks to handle arbitrary buffers. Let's do those tweaks, which cleans up an unreadable mess of temporary strings in http.c. Signed-off-by: Jeff King <> Signed-off-by: Junio C Hamano <>
2011-03-22Fix sparse warningsStephen Boyd
Fix warnings from 'make check'. - These files don't include 'builtin.h' causing sparse to complain that cmd_* isn't declared: builtin/clone.c:364, builtin/fetch-pack.c:797, builtin/fmt-merge-msg.c:34, builtin/hash-object.c:78, builtin/merge-index.c:69, builtin/merge-recursive.c:22 builtin/merge-tree.c:341, builtin/mktag.c:156, builtin/notes.c:426 builtin/notes.c:822, builtin/pack-redundant.c:596, builtin/pack-refs.c:10, builtin/patch-id.c:60, builtin/patch-id.c:149, builtin/remote.c:1512, builtin/remote-ext.c:240, builtin/remote-fd.c:53, builtin/reset.c:236, builtin/send-pack.c:384, builtin/unpack-file.c:25, builtin/var.c:75 - These files have symbols which should be marked static since they're only file scope: submodule.c:12, diff.c:631, replace_object.c:92, submodule.c:13, submodule.c:14, trace.c:78, transport.c:195, transport-helper.c:79, unpack-trees.c:19, url.c:3, url.c:18, url.c:104, url.c:117, url.c:123, url.c:129, url.c:136, thread-utils.c:21, thread-utils.c:48 - These files redeclare symbols to be different types: builtin/index-pack.c:210, parse-options.c:564, parse-options.c:571, usage.c:49, usage.c:58, usage.c:63, usage.c:72 - These files use a literal integer 0 when they really should use a NULL pointer: daemon.c:663, fast-import.c:2942, imap-send.c:1072, notes-merge.c:362 While we're in the area, clean up some unused #includes in builtin files (mostly exec_cmd.h). Signed-off-by: Stephen Boyd <> Signed-off-by: Junio C Hamano <>
2010-11-26url: add str wrapper for end_url_with_slash()Tay Ray Chuan
Helped-by: Johnathan Nieder <> Signed-off-by: Tay Ray Chuan <> Signed-off-by: Junio C Hamano <>
2010-11-26shift end_url_with_slash() from http.[ch] to url.[ch]Tay Ray Chuan
This allows non-http/curl users to access it too (eg. http-backend.c). Update include headers in end_url_with_slash() users too. Signed-off-by: Tay Ray Chuan <> Signed-off-by: Junio C Hamano <>
2010-07-26Do not unquote + into ' ' in URLsThomas Rast
Since 9d2e942 (decode file:// and ssh:// URLs, 2010-05-23) the URL logic unquotes escaped URLs. For the %2B type of escape, this is conformant with RFC 2396. However, it also unquotes + into a space character, which is only appropriate for the query strings in HTTP. This notably broke fetching from the gtk+ repository. We cannot just remove the corresponding code since the same url_decode_internal() is also used by the HTTP backend to decode query parameters. Introduce a new argument that controls whether the + decoding happens, and use it only in the (client-side) url_decode(). Reported-by: Jasper St. Pierre <> Signed-off-by: Thomas Rast <> Signed-off-by: Junio C Hamano <>
2010-06-24url_decode: URL scheme ends with a colon and does not require a slashJunio C Hamano
Signed-off-by: Junio C Hamano <>
2010-06-23url.c: "<scheme>://" part at the beginning should not be URL decodedJunio C Hamano
When using the protocol git+ssh:// for example we do not want to decode the '+' as a space. The url decoding must take place only for the server name and parameters. This fixes a regression introduced in 9d2e942. Initial-fix-by: Pascal Obry <> Acked-by: Jeff King <> Signed-off-by: Junio C Hamano <>
2010-05-24make url-related functions reusableJeff King
The is_url function and url percent-decoding functions were static, but are generally useful. Let's make them available to other parts of the code. Signed-off-by: Jeff King <> Signed-off-by: Junio C Hamano <>