equal
deleted
inserted
replaced
10 import struct |
10 import struct |
11 import sys |
11 import sys |
12 import threading |
12 import threading |
13 |
13 |
14 from .i18n import _ |
14 from .i18n import _ |
|
15 from .thirdparty import ( |
|
16 cbor, |
|
17 ) |
15 from .thirdparty.zope import ( |
18 from .thirdparty.zope import ( |
16 interface as zi, |
19 interface as zi, |
17 ) |
20 ) |
18 from . import ( |
21 from . import ( |
19 encoding, |
22 encoding, |
561 |
564 |
562 if isinstance(rsp, wireprototypes.bytesresponse): |
565 if isinstance(rsp, wireprototypes.bytesresponse): |
563 action, meta = reactor.onbytesresponseready(outstream, |
566 action, meta = reactor.onbytesresponseready(outstream, |
564 command['requestid'], |
567 command['requestid'], |
565 rsp.data) |
568 rsp.data) |
|
569 elif isinstance(rsp, wireprototypes.cborresponse): |
|
570 encoded = cbor.dumps(rsp.value, canonical=True) |
|
571 action, meta = reactor.onbytesresponseready(outstream, |
|
572 command['requestid'], |
|
573 encoded, |
|
574 iscbor=True) |
566 else: |
575 else: |
567 action, meta = reactor.onapplicationerror( |
576 action, meta = reactor.onapplicationerror( |
568 _('unhandled response type from wire proto command')) |
577 _('unhandled response type from wire proto command')) |
569 |
578 |
570 if action == 'sendframes': |
579 if action == 'sendframes': |
598 def getargs(self, args): |
607 def getargs(self, args): |
599 data = {} |
608 data = {} |
600 for k in args.split(): |
609 for k in args.split(): |
601 if k == '*': |
610 if k == '*': |
602 raise NotImplementedError('do not support * args') |
611 raise NotImplementedError('do not support * args') |
603 else: |
612 elif k in self._args: |
604 data[k] = self._args[k] |
613 data[k] = self._args[k] |
605 |
614 |
606 return [data[k] for k in args.split()] |
615 return data |
607 |
616 |
608 def getprotocaps(self): |
617 def getprotocaps(self): |
609 # Protocol capabilities are currently not implemented for HTTP V2. |
618 # Protocol capabilities are currently not implemented for HTTP V2. |
610 return set() |
619 return set() |
611 |
620 |