( )⚙ D2064 wireprotoserver: document and improve the httplib workaround

This is an archive of the discontinued Mercurial Phabricator instance.

wireprotoserver: document and improve the httplib workaround
ClosedPublic

Authored by indygreg on Feb 6 2018, 4:04 PM.

Details

Summary

This workaround dates all the way back to a42d27bc809d in 2008.
The code is esoteric enough to warrant an inline explanation.
So I've added one.

At the time the code was written, the only wire protocol command
that accepted an HTTP request body was "unbundle." In the years
since, we've grown the ability to accept command arguments via
HTTP POST requests. So, the code has been changed to apply the
httplib workaround to all HTTP POST requests.

While staring at this code, I realized that the HTTP response
body in case of error is always the same. And, it appears to
mimic the behavior of a failed call to the "unbundle" command.
Since we can hit this code path on theoretically any protocol
request (since self.check_perm accepts custom auth checking
functions which may raise), I'm having a hard time believing
that clients react well to an "unbundle" response payload on
any wire protocol command. I wouldn't be surprised if our test
coverage for this feature only covers HTTP POST calls to
"unbundle." In other words, the experimental support for sending
arguments via HTTP POST request bodies may result in badness on
the client. Something to investigate another time perhaps...

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.Feb 6 2018, 4:04 PM
durin42 accepted this revision.Feb 7 2018, 5:19 PM
durin42 added a subscriber: durin42.

I'm so sorry for this technical debt, even if it's httplib's fault. :/

This revision is now accepted and ready to land.Feb 7 2018, 5:19 PM
This revision was automatically updated to reflect the committed changes.