(
self, command: RegisterHttpConnection
)
| 1159 | yield from self.event_to_child(stack[0], events.Start()) |
| 1160 | |
| 1161 | def register_connection( |
| 1162 | self, command: RegisterHttpConnection |
| 1163 | ) -> layer.CommandGenerator[None]: |
| 1164 | waiting = self.waiting_for_establishment.pop(command.connection) |
| 1165 | |
| 1166 | reply: tuple[None, str] | tuple[Connection, None] |
| 1167 | if command.err: |
| 1168 | reply = (None, command.err) |
| 1169 | else: |
| 1170 | reply = (command.connection, None) |
| 1171 | |
| 1172 | for cmd in waiting: |
| 1173 | stream = self.command_sources.pop(cmd) |
| 1174 | yield from self.event_to_child( |
| 1175 | stream, GetHttpConnectionCompleted(cmd, reply) |
| 1176 | ) |
| 1177 | |
| 1178 | # Tricky multiplexing edge case: Assume we are doing HTTP/2 -> HTTP/1 proxying and the destination server |
| 1179 | # only serves responses with HTTP read-until-EOF semantics. In this case we can't process two flows on the |
| 1180 | # same connection. The only workaround left is to open a separate connection for each flow. |
| 1181 | if ( |
| 1182 | not command.err |
| 1183 | and self.context.client.alpn == b"h2" |
| 1184 | and command.connection.alpn != b"h2" |
| 1185 | ): |
| 1186 | for cmd in waiting[1:]: |
| 1187 | yield from self.get_connection(cmd, reuse=False) |
| 1188 | break |
| 1189 | |
| 1190 | |
| 1191 | class HttpClient(layer.Layer): |
no test coverage detected