Closed Bug 1295987 Opened 8 years ago Closed 8 years ago

git mozreview push generates lowercase HTTP header names, which can confuse broken proxies

Categories

(MozReview Graveyard :: Integration: Git, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: ayg, Unassigned)

Details

I ported my gecko-dev checkout to cinnabar and set up MozReview following the instructions.  Now "git mozreview push" returns some SSL warnings (about SNI not being available and cert verification being disabled, should not be relevant) followed by

  urllib2.HTTPError: HTTP Error 403: Forbidden
  abort: error performing cinnabar push; please report this bug

In my git config, mozreview.remote is set to hg::https://reviewboard-hg.mozilla.org/gecko, which is what "git mozreview configure" set it to.

This blocks my use of MozReview for the moment.
Please post the actual command output. Fragments don't give us enough context to work on.
Flags: needinfo?(ayg)
I think this is a problem on my end.  I'll reopen if that proves not to be the case.
Status: NEW → RESOLVED
Closed: 8 years ago
Flags: needinfo?(ayg)
Resolution: --- → INVALID
I tracked down the problem.  "git mozreview push" generates the following HTTP request:

  GET http://reviewboard-hg.mozilla.org/gecko?cmd=capabilities HTTP/1.1
  Accept-Encoding: identity
  host: reviewboard-hg.mozilla.org
  accept: application/mercurial-0.1
  [etc.]

This is perfectly correct per spec, because HTTP header names are case-insensitive.  However, I happen to be trying to do all this behind a broken proxy that I think expects the header names to be capitalized, as is customary (I suspect "Host" is the problem).  I tried poking at things to see if I could find how to fix it, but I failed.  This is likely a problem that will only ever affect me, but do you know how to fix it, or where I should look to fix it?
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
Summary: git mozreview push fails with 403 Forbidden → git mozreview push generates lowercase HTTP header names, which can confuse broken proxies
You've got to be kidding me.

This is likely a bug in git-cinnabar since git-cinnabar is the thing generating the HTTP requests.
To clarify, I'm astounded the lowercase header problem is still a problem in 2016. I haven't seen this type of failure in several years. It saddens me that we'll have to work around it.
There are always going to be people who use regex or string-matching for scraping things instead of standards-conformant parsers, and they're only going to test on browsers, so anything that doesn't behave like a browser might break.  That's going to be a fact forever.  Which is basically just Postel's law.
Do you know where this code might live?
Flags: needinfo?(mh+mozilla)
(In reply to Gregory Szorc [:gps] from comment #4)
> You've got to be kidding me.
> 
> This is likely a bug in git-cinnabar since git-cinnabar is the thing
> generating the HTTP requests.

Not in the default configuration. In the default configuration, mercurial is.
Flags: needinfo?(mh+mozilla)
and mercurial uses python's httplib iirc.
Does vanilla Mercurial exhibit the behavior or your misbehaving HTTP proxy? If so, then this is an upstream bug. If not, then there's something in the interaction of cinnabar or mozreview triggering it.
I've confirmed that the issue is in hg, so I'll take the issue elsewhere.  Thanks, and sorry for the bother.

But as a workaround -- Mike, you said "in the default configuration".  Is there a way to get it to not use Mercurial?
Status: REOPENED → RESOLVED
Closed: 8 years ago8 years ago
Flags: needinfo?(mh+mozilla)
Resolution: --- → INVALID
(In reply to :Aryeh Gregor (working until September 2) from comment #11)
> But as a workaround -- Mike, you said "in the default configuration".  Is
> there a way to get it to not use Mercurial?

An experimental way, yes, on 0.4.0 beta. Build the helper (make helper, or download it from the github release page), and `git config cinnabar.experiments true`.
Flags: needinfo?(mh+mozilla)
You need to log in before you can comment on or make changes to this bug.