##// END OF EJS Templates
wireproto: document the wonky push protocol for SSH...
Gregory Szorc -
r36390:b8d0761a default
parent child Browse files
Show More
@@ -466,25 +466,40 class sshv1peer(wireproto.wirepeer):
466 466 return self._sendrequest(cmd, args, framed=True).read()
467 467
468 468 def _callpush(self, cmd, fp, **args):
469 # The server responds with an empty frame if the client should
470 # continue submitting the payload.
469 471 r = self._call(cmd, **args)
470 472 if r:
471 473 return '', r
474
475 # The payload consists of frames with content followed by an empty
476 # frame.
472 477 for d in iter(lambda: fp.read(4096), ''):
473 478 self._writeframed(d)
474 479 self._writeframed("", flush=True)
480
481 # In case of success, there is an empty frame and a frame containing
482 # the integer result (as a string).
483 # In case of error, there is a non-empty frame containing the error.
475 484 r = self._readframed()
476 485 if r:
477 486 return '', r
478 487 return self._readframed(), ''
479 488
480 489 def _calltwowaystream(self, cmd, fp, **args):
490 # The server responds with an empty frame if the client should
491 # continue submitting the payload.
481 492 r = self._call(cmd, **args)
482 493 if r:
483 494 # XXX needs to be made better
484 495 raise error.Abort(_('unexpected remote reply: %s') % r)
496
497 # The payload consists of frames with content followed by an empty
498 # frame.
485 499 for d in iter(lambda: fp.read(4096), ''):
486 500 self._writeframed(d)
487 501 self._writeframed("", flush=True)
502
488 503 return self._pipei
489 504
490 505 def _getamount(self):
@@ -347,12 +347,16 class sshv1protocolhandler(wireprototype
347 347 return [data[k] for k in keys]
348 348
349 349 def forwardpayload(self, fpout):
350 # We initially send an empty response. This tells the client it is
351 # OK to start sending data. If a client sees any other response, it
352 # interprets it as an error.
353 _sshv1respondbytes(self._fout, b'')
354
350 355 # The file is in the form:
351 356 #
352 357 # <chunk size>\n<chunk>
353 358 # ...
354 359 # 0\n
355 _sshv1respondbytes(self._fout, b'')
356 360 count = int(self._fin.readline())
357 361 while count:
358 362 fpout.write(self._fin.read(count))
General Comments 0
You need to be logged in to leave comments. Login now