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

Re: git-receive-pack --stateless-rpc

From
Shawn Pearce <spearce@spearce.org>
Date
Jun 17, 2010, 14:00 UTC
Message-ID
<AANLkTimZxcljR4soYWVeExr27Md7jmsE1Mfx3Vcbf9SI@mail.gmail.com>
In-Reply-To
<AANLkTikbUp7_22alAbgNFO30R7vkPUAOr7qvJ6a86Zc7@mail.gmail.com>
On Thu, Jun 17, 2010 at 6:45 AM, Yiyi Sun <yiyisun@gmail.com> wrote:
Show 13 quoted lines
> I am creating a Git smart HTTP protocol wrapper and run into two
> problem. I tried the msysGit mailing list and was told to ask them to
> the main git mailing list.
>
> Here is the story. During 'git push',  I successfully processed the
> initial GET request of '/info/refs?service=git-receive-pack' by
> sending back the output of 'git receive-pack --stateless-rpc
> --advertise-refs'. Then msysGit did a the POST request. I
> invoked 'git receive-pack --stateless-rpc', which returned:
>
> 0030 000eunpack ok
> 0019ok refs/heads/master
> 00000000

That doesn't look right to me. There appears to be a space at the start of the packet (between 0030 and 000e), which would confuse the protocol. Otherwise, that appears to be a valid response from receive-pack assuming the client asked for side-band-64k in the request, and it pushed only refs/heads/master.

Show 5 quoted lines
> Question #1, Is the result supposed to be something below instead?
>
> 000eunpack ok
> 0019ok refs/heads/master
> 0000

Depends on whether or not the client asked for side-band-64k. If it did, we wrap it up in a another pkt-line framing like above, and end with another flush-pkt. If the client didn't ask for side-band-64k, then the above would be the correct response.

Show 5 quoted lines
> Question #2, msysGit cannot parse the result, it displays error message:
>
> fatal: protocol error: bad line length character:
> 003
> fatal: The remote end hung up unexpectedly

This is weird. "003" isn't valid, its not 4 bytes long. What was that trailing final 4th byte right there? If its a space like it is above (though then its really in the wrong spot, isn't it?) that would throw it all off.

It sounds to me like your wrapper is mangling the data that is passing through it on the way back to the client.

-- 
Shawn.
Previous: Yiyi SunNext: Shawn O. Pearce
Message 2 of 3 in “Fwd: git-receive-pack --stateless-rpc”
  1. Yiyi SunJun 17, 2010
  2. Shawn PearceJun 17, 2010
  3. Shawn O. PearceJun 17, 2010

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.