>From 7.21.5, curl can be tricked into using an open fd.
This series uses this to allow using curl over a tunnel.
I have a few doubt on patch #2:
- is socketpair working on all git supported system (windows ?)
- should socketpair always be used or limited to the curl over tunnel case ?
I don't think there is too much different between an unname pipe and a
socketpair but I'm not sure either :)
This series also shows a "bug" in curl.
When trying out the tunnel example fro imap-send documentation, this happends:
Starting tunnel 'ssh -q -C localhost /usr/sbin/imapd ./Maildir'... ok
sending 3 messages
16:38:54.055221 http.c:639 == Info: Hostname was NOT found in DNS
cache
16:38:54.059505 http.c:639 == Info: Trying ::1...
16:38:54.059545 http.c:639 == Info: Connected to localhost () port
143 (#0)
16:38:54.354379 http.c:586 <= Recv header, 0000000332 bytes
(0x0000014c)
16:38:54.354405 http.c:598 <= Recv header: * PREAUTH [CAPABILITY
IMAP4REV1 I18NLEVEL=1 LITERAL+ IDLE UIDPLUS NAMESPACE CHILDREN
MAILBOX-REFERRALS BINARY UNSELECT ESEARCH WITHIN SCAN SORT THREAD=REFERENCES
THREAD=ORDEREDSUBJECT MULTIAPPEND] Pre-authenticated user nmorey
portia.home.nicolas.morey-chaisemartin.com IMAP4rev1 2007e.404 at Wed, 9 Aug
2017 16:38:54 +0200 (CEST)
16:38:54.354425 http.c:639 == Info: Bad tagged response
16:38:54.354448 http.c:639 == Info: Closing connection 0
curl_easy_perform() failed: FTP: weird server reply
It appears curl do not support the PREAUTH tag.
However a test with "nc imap.server.ext 143" is working fine.
Nicolas Morey-Chaisemartin (3):
imap-send: move tunnel setup to its own function
imap-send: use a socketpair instead of pipe to communicate with the
tunnel
imap_send: add support for curl over tunnel
Documentation/git-imap-send.txt | 4 +-
imap-send.c | 91 +++++++++++++++++++++++++++++++----------
2 files changed, 72 insertions(+), 23 deletions(-)