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

Re: [PATCH] http.c: don't rewrite the user:passwd string multiple times

From
Daniel Stenberg <daniel@haxx.se>
Date
Jun 18, 2013, 06:36 UTC
Message-ID
<alpine.DEB.2.00.1306180825460.24456@tvnag.unkk.fr>
In-Reply-To
<20130618051902.GA5916@sigill.intra.peff.net>
On Tue, 18 Jun 2013, Jeff King wrote:
TL;DR: I'm just confirming what's said here! =)
Show 7 quoted lines
> My understanding of curl's pointer requirements are:
>
>  1. Older versions of curl (and I do not recall which version off-hand,
>     but it is not important) stored just the pointer. Calling code was
>     required to manage the string lifetime itself.
>
>  2. Newer versions of curl will strdup the string in curl_easy_setopt.

That's correct. This "new" behavior in (2) was introduced in libcurl 7.17.0 - released in September 2007 and should thus be fairly rare by now.

I mention this primarily because I think it should be noted that there will probably be very little testing by users with such old libcurl versions. It may increase the time between a committed change and people notice brekages caused by it. Even Debian old-stable has a much newer version.

Show 6 quoted lines
> For older versions, if we were to grow the strbuf, we might free() the 
> pointer provided to an earlier call to curl_easy_setopt. But since we are 
> about to call curl_easy_setopt with the new value, I would assume that curl 
> will never actually look at the old one (i.e., when replacing an old 
> pointer, it would not dereference it, but simply overwrite it with the new 
> value).
Another accurate description.
-- 
  / daniel.haxx.se
Previous: Jeff KingNext: Junio C Hamano
Message 4 of 11 in “http.c: don't rewrite the user:passwd string multiple times”
  1. http.c: don't rewrite the user:passwd string multiple timesBrandon Casey, Jun 18, 2013
  2. Eric SunshineJun 18, 2013
  3. Jeff KingJun 18, 2013
  4. Daniel StenbergJun 18, 2013
  5. Junio C HamanoJun 18, 2013
  6. Brandon CaseyJun 18, 2013
  7. Jeff KingJun 18, 2013
  8. Brandon CaseyJun 19, 2013
  9. http.c: don't rewrite the user:passwd string multiple timesBrandon Casey, Jun 19, 2013
  10. Jeff KingJun 19, 2013
  11. Daniel StenbergJun 19, 2013

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.