git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: git@vger.kernel.org
Subject: git+http:// proof-of-concept (not using CONNECT)
Date: Thu, 2 Jul 2009 01:54:40 -0700	[thread overview]
Message-ID: <20090702085440.GC11119@dcvr.yhbt.net> (raw)

I've been toying around with an HTTP server for various things over the
past few months and a few weeks ago I came up with the idea of tunneling
arbitrary stream protocols over HTTP with "Transfer-Encoding: chunked"
bodies on both ends.  This allowed me to tunnel the git:// protocol
among other things over something that may conform to RFC 2616.

To facilitate this, curl needed only one minor modification (now in
their CVS repository) to make stdin with "-T-" non-blocking:

  http://cool.haxx.se/cvs.cgi/curl/src/main.c.diff?r1=1.520&r2=1.521

Since git clone already supports proxy commands via GIT_PROXY_COMMAND, I
just created a one line shell script to use as GIT_PROXY_COMMAND.  No
modifications were needed to git itself on either end:

cat > /path/to/script <<\EOF
#!/bin/sh
exec curl --no-buffer -sSfT- http://$1:$2/
EOF

chmod +x /path/to/script
GIT_PROXY_COMMAND=/path/to/script
export GIT_PROXY_COMMAND

# Then, to test it on a small project on my server:
git clone git://git.bogomips.org:8080/pcu

# Of course, a larger project like git should work, too:
git clone git://git.bogomips.org:8080/mirrors/git

Hopefully it doesn't blow up or die on you, this is only lightly
tested.  Let me know if you manage to break it permanently.


The origin server I'm running for this is the latest release of
Unicorn[2], which supports sending a chunked HTTP response as it is
receiving a chunked request.  Unicorn just dechunks the request and
pipes it to git-daemon.  When git-daemon writes to stdout, Unicorn just
grabs the output and chunks it (via Rack[3] middleware) for the client.


This doesn't work in the face of most HTTP-aware proxies[1], so it
probably doesn't help those who have trouble accessing git:// servers in
the first place...  However, this could potentially be useful in places
where a proxy providing CONNECT is not available.


[1] - I run nginx on port 80 on bogomips.org and nginx (attempts to)
fully buffer all requests before proxying it to the backend, so it
definitely won't fly here.  HTTP proxies are perfectly alright with
taking chunked requests/responses and remove chunking on them (or
vice versa).

[2] - http://unicorn.bogomips.org/
[3] - http://rack.rubyforge.org/

-- 
Eric Wong

             reply	other threads:[~2009-07-02  8:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-02  8:54 Eric Wong [this message]
2009-07-02  9:52 ` git+http:// proof-of-concept (not using CONNECT) Constantine Plotnikov
2009-07-03 20:28   ` Eric Wong
2009-07-07 16:14     ` Tony Finch
2009-07-07 20:50       ` Eric Wong
2009-08-26 14:34         ` Douglas Campos
2009-09-05  8:23           ` Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090702085440.GC11119@dcvr.yhbt.net \
    --to=normalperson@yhbt.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).