Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/httppeer.py @ 40133:762ef19a07e3
wireprotov2: send protocol settings frame from client
Now that we have client and server reactor support for protocol
settings and encoding frames, we can start to send them out over
the wire!
This commit teaches the client reactor to send out a protocol
settings frame when needed. The httpv2 peer has been taught to
gather a list of supported content encoders and to advertise them
through the client reactor.
Because the client is now sending new frame types by default, this
constitutes a compatibility break in the framing protocol. The
media type version has been bumped accordingly. This will ensure
existing clients won't attempt to send the new frames to old
servers not supporting this explicit media type. I'm not bothering
with the BC annotation because everything wireprotov2 is highly
experimental and nobody should be running a server yet.
Differential Revision: https://phab.mercurial-scm.org/D4922
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 08 Oct 2018 17:00:16 -0700 |
parents | 293835e0fff7 |
children | dac438b7346e |
comparison
equal
deleted
inserted
replaced
40132:e67522413ca8 | 40133:762ef19a07e3 |
---|---|
512 def _abort(self, exception): | 512 def _abort(self, exception): |
513 raise exception | 513 raise exception |
514 | 514 |
515 def sendv2request(ui, opener, requestbuilder, apiurl, permission, requests, | 515 def sendv2request(ui, opener, requestbuilder, apiurl, permission, requests, |
516 redirect): | 516 redirect): |
517 wireprotoframing.populatestreamencoders() | |
518 | |
519 uiencoders = ui.configlist(b'experimental', b'httppeer.v2-encoder-order') | |
520 | |
521 if uiencoders: | |
522 encoders = [] | |
523 | |
524 for encoder in uiencoders: | |
525 if encoder not in wireprotoframing.STREAM_ENCODERS: | |
526 ui.warn(_(b'wire protocol version 2 encoder referenced in ' | |
527 b'config (%s) is not known; ignoring\n') % encoder) | |
528 else: | |
529 encoders.append(encoder) | |
530 | |
531 else: | |
532 encoders = wireprotoframing.STREAM_ENCODERS_ORDER | |
533 | |
517 reactor = wireprotoframing.clientreactor(ui, | 534 reactor = wireprotoframing.clientreactor(ui, |
518 hasmultiplesend=False, | 535 hasmultiplesend=False, |
519 buffersends=True) | 536 buffersends=True, |
537 clientcontentencoders=encoders) | |
520 | 538 |
521 handler = wireprotov2peer.clienthandler(ui, reactor, | 539 handler = wireprotov2peer.clienthandler(ui, reactor, |
522 opener=opener, | 540 opener=opener, |
523 requestbuilder=requestbuilder) | 541 requestbuilder=requestbuilder) |
524 | 542 |