mirror of
https://gitea.invidious.io/iv-org/Invidious-quic-proxy.git
synced 2024-08-15 00:43:22 +00:00
Remove HTTP Push event handling.
Nothing is currently done with its results and neither does Invidious recognize PUSH
This commit is contained in:
parent
9ed02b7187
commit
1cf2b276c5
1 changed files with 0 additions and 30 deletions
|
@ -16,7 +16,6 @@ from aioquic.h3.connection import H3_ALPN, H3Connection
|
||||||
from aioquic.h3.events import (
|
from aioquic.h3.events import (
|
||||||
DataReceived,
|
DataReceived,
|
||||||
HeadersReceived,
|
HeadersReceived,
|
||||||
PushPromiseReceived,
|
|
||||||
)
|
)
|
||||||
from aioquic.quic.configuration import QuicConfiguration
|
from aioquic.quic.configuration import QuicConfiguration
|
||||||
from aioquic.asyncio.client import connect as connect_quic_client
|
from aioquic.asyncio.client import connect as connect_quic_client
|
||||||
|
@ -40,7 +39,6 @@ class HttpClient(QuicConnectionProtocol):
|
||||||
def __init__(self, *args, **kwargs) -> None:
|
def __init__(self, *args, **kwargs) -> None:
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
self.pushes = {}
|
|
||||||
self._http = H3Connection(self._quic)
|
self._http = H3Connection(self._quic)
|
||||||
self._request_events = {}
|
self._request_events = {}
|
||||||
self._request_waiter = {}
|
self._request_waiter = {}
|
||||||
|
@ -75,14 +73,6 @@ class HttpClient(QuicConnectionProtocol):
|
||||||
request_waiter = self._request_waiter.pop(stream_id)
|
request_waiter = self._request_waiter.pop(stream_id)
|
||||||
request_waiter.set_result(self._request_events.pop(stream_id))
|
request_waiter.set_result(self._request_events.pop(stream_id))
|
||||||
|
|
||||||
elif event.push_id in self.pushes:
|
|
||||||
# push
|
|
||||||
self.pushes[event.push_id].append(event)
|
|
||||||
|
|
||||||
elif isinstance(event, PushPromiseReceived):
|
|
||||||
self.pushes[event.push_id] = collections.deque()
|
|
||||||
self.pushes[event.push_id].append(event)
|
|
||||||
|
|
||||||
def quic_event_received(self, event):
|
def quic_event_received(self, event):
|
||||||
# pass event to the HTTP layer
|
# pass event to the HTTP layer
|
||||||
for http_event in self._http.handle_event(event):
|
for http_event in self._http.handle_event(event):
|
||||||
|
@ -146,23 +136,6 @@ async def perform_http_request(client, url, method, headers, data, store_at):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def process_http_pushes(client):
|
|
||||||
for _, http_events in client.pushes.items():
|
|
||||||
method = ""
|
|
||||||
octets = 0
|
|
||||||
path = ""
|
|
||||||
for http_event in http_events:
|
|
||||||
if isinstance(http_event, DataReceived):
|
|
||||||
octets += len(http_event.data)
|
|
||||||
elif isinstance(http_event, PushPromiseReceived):
|
|
||||||
for header, value in http_event.headers:
|
|
||||||
if header == b":method":
|
|
||||||
method = value.decode()
|
|
||||||
elif header == b":path":
|
|
||||||
path = value.decode()
|
|
||||||
logger.info("Push received for %s %s : %s bytes", method, path, octets)
|
|
||||||
|
|
||||||
|
|
||||||
async def handle_response(http_events, store_at=None):
|
async def handle_response(http_events, store_at=None):
|
||||||
resulting_data = {}
|
resulting_data = {}
|
||||||
_accumulator = b""
|
_accumulator = b""
|
||||||
|
@ -215,7 +188,4 @@ async def request(url, method, headers=None, data=None):
|
||||||
await perform_http_request(client=client, url=parsed, method=method, headers=headers, data=data,
|
await perform_http_request(client=client, url=parsed, method=method, headers=headers, data=data,
|
||||||
store_at=response_storage)
|
store_at=response_storage)
|
||||||
|
|
||||||
# process http pushes
|
|
||||||
await process_http_pushes(client=client)
|
|
||||||
|
|
||||||
return response_storage
|
return response_storage
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue