From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/14052 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: vlse Newsgroups: gmane.linux.lib.musl.general Subject: Re: Supporting git access via smart HTTPS protocol for musl-libc Date: Wed, 3 Apr 2019 12:12:00 +0530 Message-ID: <20190403064159.GA3647@localhost> References: <20190326154700.GC23599@brightrain.aerifal.cx> <20190326155743.GC2267@homura.localdomain> <20190326175700.GD23599@brightrain.aerifal.cx> <20190326220225.GE23599@brightrain.aerifal.cx> <20190326235835.GF23599@brightrain.aerifal.cx> <20190327001542.GG23599@brightrain.aerifal.cx> <20190327053933.GA2518@localhost> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="111482"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.4.2.3i Cc: dalias@libc.org To: musl@lists.openwall.com Original-X-From: musl-return-14068-gllmg-musl=m.gmane.org@lists.openwall.com Wed Apr 03 08:41:36 2019 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1hBZaa-000Svg-8Z for gllmg-musl@m.gmane.org; Wed, 03 Apr 2019 08:41:36 +0200 Original-Received: (qmail 13505 invoked by uid 550); 3 Apr 2019 06:41:33 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 13477 invoked from network); 3 Apr 2019 06:41:32 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=veera.biz; s=default; h=In-Reply-To:Content-Type:Mime-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=pfwwwpXP/LbS7EfpDx6JspTkV5AZtMTbC50xLjSzGiY=; b=Y9FNZUlR9b8y4DwQVpfk5SqbZk kWTs1z/++f7tcreG0v+lhbKTDRKE3gZO6vzRjxkbTqgSxK1vyz8oTl4B62iQcJaqGweQKzfwtyN56 WBmXLv6zOXNPLcg9uxNXiLlRk+8SboBjuwf2Su5C5kaOeyWP/qwU47deLnGijK0YGx/7zV7uuc31/ T/4n2dL5qckvrgR2v58zkmcvNuwIRCaKdc8aGQdiXLWa7CbrYuY8svGvehBlS4Z3D72ppe61vkGCB 5afMvVm/2EJSzXMpBOgn4FDWqq1N3WMmSfy3+44qBhxAkUls17s4Yb8wVLqkNCOO4UKeMoG9g8z95 R8BG19Qg==; Content-Disposition: inline In-Reply-To: X-OutGoing-Spam-Status: No, score=-0.2 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - in-pun-ln-srv139.advancedserverdns.com X-AntiAbuse: Original Domain - lists.openwall.com X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - veera.biz X-Get-Message-Sender-Via: in-pun-ln-srv139.advancedserverdns.com: authenticated_id: vlse@veera.biz X-Authenticated-Sender: in-pun-ln-srv139.advancedserverdns.com: vlse@veera.biz Xref: news.gmane.org gmane.linux.lib.musl.general:14052 Archived-At: On Wed, Mar 27, 2019 at 11:26:22AM -0600, Assaf Gordon wrote: > Hello, > > On 2019-03-26 11:39 p.m., vlse wrote: > >On Tue, Mar 26, 2019 at 08:15:42PM -0400, Rich Felker wrote: > >>On Tue, Mar 26, 2019 at 07:58:35PM -0400, Rich Felker wrote: > >>>On Tue, Mar 26, 2019 at 04:32:32PM -0600, Assaf Gordon wrote: > >>>>> > >>>>>[...] I suspect thttpd is doing something broken with > >>>>>the POST request since the git clone breaks during that. > >>>> > >>>>The same happened to me with busybox, and was solved by forcing: > >>>> > >>>> export HTTP_CONTENT_ENCODING=gzip > >>>> > >>>Amazingly, this works, but only if I do it only for > >>>REQUEST_METHOD=POST. Otherwise it breaks the GET request and it never > >>>makes it to the POST. > > >This does not works: > >mkdir musl.git > >cd musl.git > >git init > >git remote add -t master -m master origin > >https://git.musl-libc.org/git/musl > > > >git-fetch gives errors: > > fatal: protocol error: bad line length character: erro > > Thanks for checking and for the detailed reproducer. > > This error tells me there is (again) a binary/text conflict, > > The (text) git protocol always starts with 4 hex digits > indicating length. If the input is gzip'd and wasn't > decompressed, the length indicator will be invalid. > > Digging further, it seems that in this case the "git fetch" > command sent POST data which is *not* compressed. > Forcing "CONTENT_ENCODING=gzip" always or for all POST request > is not sufficient. > > I now use the following shell wrapper, which works for > both "git clone" and your "git fetch" case. > I won't claim it's pretty, but it works (with busybox httpd). > The "echo>&2" will show up on webserver's error log. > > ---- > #!/bin/sh > > export GIT_HTTP_EXPORT_ALL=true > export GIT_PROJECT_ROOT=/home/gordon/projects/ > > echo START - $REQUEST_METHOD $PATH_INFO >&2 > > # Check if POST data is text or binary, add HTTP header if needed. > if test "$REQUEST_METHOD" = POST ; then > t=$(mktemp -t git-http-backend-XXXXXX) > # Store STDIN and examine it > cat - > $t > > # Git (text) protocol starts with 4 hex digits indicating length. > # If the first 4 bytes aren't hexdigits, assume STDIN is compressed. > if head -c4 $t | grep -q '^[0-9a-f][0-9a-f][0-9a-f][0-9a-f]$' ; then > echo "POST data is not gzipped" >&2 > else > echo "POST data is gzipped" >&2 > export HTTP_CONTENT_ENCODING=gzip > fi > > # restore STDIN > exec < $t > rm $t > fi > /usr/lib/git-core/git-http-backend > echo END - $REQUEST_METHOD $PATH_INFO >&2 > echo >&2 > echo >&2 > > ---- > > As Rich said, there's got to be a better way... > > > Regards, > -assaf Hi, I previously reported that doing git clone and then git pull was showing no errors. git pull said "Already upto Date" But when I did git pull again, I got the following errors: fatal: protocol error: bad line length character: erro This was same error which I told when a fresh git fetch was producing. The git pull actually invokes git fetch followed by git merge. After a fresh clone and then doing git pull immediately does not invokes git fetch at all. Regards, Veera