(self, sock)
| 105 | self._as_bytes = as_bytes |
| 106 | |
| 107 | def send(self, sock): |
| 108 | as_bytes = self._as_bytes |
| 109 | try: |
| 110 | if get_protocol() in (HTTP_PROTOCOL, HTTP_JSON_PROTOCOL): |
| 111 | sock.sendall(("Content-Length: %s\r\n\r\n" % len(as_bytes)).encode("ascii")) |
| 112 | sock.sendall(as_bytes) |
| 113 | if self._after_send: |
| 114 | for method in self._after_send: |
| 115 | method(sock) |
| 116 | except: |
| 117 | if IS_JYTHON: |
| 118 | # Ignore errors in sock.sendall in Jython (seems to be common for Jython to |
| 119 | # give spurious exceptions at interpreter shutdown here). |
| 120 | pass |
| 121 | else: |
| 122 | raise |
| 123 | |
| 124 | def call_after_send(self, callback): |
| 125 | if not self._after_send: |
no test coverage detected