This is an archive of the discontinued Mercurial Phabricator instance.

httppeer: don't accept very old media types (BC)
ClosedPublic

Authored by indygreg on Apr 10 2018, 9:28 PM.

Details

Summary

Versions of Mercurial older than 1.0 emitted the text/plain
and application/hg-changegroup media types in response to wire
protocol commands.

Way back in 8760d0c83b9b in 2005, the code validating these media
types was added, presumably for backwards compatibility. 0b245edec124
a short time before that commit changed things from text/plain and
application/hg-changegroup to application/mercurial-0.1 and
application/hg-0.1. 8760d0c83b9b seemed to indicate ("for now") that
the BC compatibility was temporary. But that code has lived until
this day.

It has been more than 10 years and nobody should be running pre 1.0
servers.

Pretty much the only risk to this is if there's a server somewhere
advertising the old media types or server software is interfering
and not letting Mercurial send the proper Content-Type header. I
think the chances are rare.

The wire protocol docs were created (by me) from reading existing
code. So the deletions don't constitute a spec change as much as
reflecting the reality of how things have been for years.

.. bc::

The HTTP client no longer accepts text/plain and
application/hg-changegroup Content-Type values as a valid Mercurial
command response. These should only be encountered on pre 1.0
Mercurial servers.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

indygreg created this revision.Apr 10 2018, 9:28 PM
durin42 accepted this revision.Apr 11 2018, 12:49 PM
This revision is now accepted and ready to land.Apr 11 2018, 12:49 PM
This revision was automatically updated to reflect the committed changes.