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

Re: [PATCH/RFC] git-imap-send: use libcurl for implementation

From
Bernhard Reiter <ockham@raz.or.at>
Date
Aug 17, 2014, 12:56 UTC
Message-ID
<53F0A66A.9000909@raz.or.at>
In-Reply-To
<20140817083022.GJ23808@peff.net>
Am 2014-08-17 um 10:30 schrieb Jeff King:
Show 9 quoted lines
> On Tue, Aug 12, 2014 at 06:59:17PM -0700, Jonathan Nieder wrote:
> 
>>> +		curl_socket_t sockfd = tunnel.out; // what about tunnel.in ?
>>
>> Hmm.  curl expects to get a socket it can send(), recv(), setsockopt(),
>> etc on instead of a pair of fds to read() and write().
> 
> I wonder if we could teach run_command to optionally use socketpair()
> instead of pipe(). 
That sounds like a good idea to me.
> I'm not sure if that would cause problems on Windows,
> though.

Apparently socketpair is not available there. Googling "socketpair windows" yields, among a lot of other useful resources, the following relatively actively maintained ~150 LOC, BSD-3-clause-licensed, implementation:

https://github.com/ncm/selectable-socketpair

That license is GPL compatible, so should we consider including that implementation with git? That's the kind of stuff that goes to compat/win32, right?

One thing to consider: seems like socketpair() gives AF_LOCAL sockets, so I've asked [1] on the curl ML if that would work or if libcurl needs an AF_INET one.

Show 7 quoted lines
>> I wonder why someone would want to use SSL through a tunnel, though.
>> Currently it's impossible to get to the SSL codepath when a tunnel is
>> active (it's in the 'else' block an 'if (srvc->tunnel)').  If that
>> property is preserved, then we should be safe.
> 
> I'm not sure I understand this comment. Even if SSL is not in use,
> wouldn't we be passing a regular pipe to curl, which would break?

Yeah, we can't do that, and thus would have to keep the handwritten IMAP implementation just for the tunnel case (allowing to drop only the OpenSSL specific stuff), see my other email: http://www.mail-archive.com/git@vger.kernel.org/msg56791.html (the relevant part is pretty far down at the bottom).

Bernhard
[1] http://curl.haxx.se/mail/lib-2014-08/0131.html
Previous: Jeff KingNext: Jeff King
Message 4 of 7 in “git-imap-send: use libcurl for implementation”
  1. git-imap-send: use libcurl for implementationBernhard Reiter, Aug 12, 2014
  2. Jonathan NiederAug 13, 2014
  3. Jeff KingAug 17, 2014
  4. Bernhard ReiterAug 17, 2014
  5. Jeff KingAug 17, 2014
  6. Bernhard ReiterAug 19, 2014
  7. Junio C HamanoAug 19, 2014

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.