omserv 0.0.0.dev25__py3-none-any.whl → 0.0.0.dev26__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
omserv/nginx/build.py CHANGED
@@ -10,7 +10,7 @@ from omlish import check
10
10
  from omlish import lang
11
11
 
12
12
 
13
- NGINX_VERSION = '1.27.0'
13
+ NGINX_VERSION = '1.27.1'
14
14
  NGINX_SRC_URL = f'https://nginx.org/download/nginx-{NGINX_VERSION}.tar.gz'
15
15
 
16
16
  NGINX_VTS_VERSION = '0.2.2'
@@ -107,7 +107,8 @@ class H11Protocol(Protocol):
107
107
  self.client = client
108
108
  self.config = config
109
109
  self.connection: h11.Connection | H11WsConnection = h11.Connection(
110
- h11.SERVER, max_incomplete_event_size=self.config.h11_max_incomplete_size,
110
+ h11.SERVER,
111
+ max_incomplete_event_size=self.config.h11_max_incomplete_size,
111
112
  )
112
113
  self.context = context
113
114
  self.keep_alive_requests = 0
@@ -176,31 +177,30 @@ class H11Protocol(Protocol):
176
177
  await self.send(Closed())
177
178
  break
178
179
 
179
- else:
180
- if isinstance(event, h11.Request):
181
- await self.send(Updated(idle=False))
182
- await self._check_protocol(event)
183
- await self._create_stream(event)
180
+ if isinstance(event, h11.Request):
181
+ await self.send(Updated(idle=False))
182
+ await self._check_protocol(event)
183
+ await self._create_stream(event)
184
184
 
185
- elif event is h11.PAUSED:
186
- await self.can_read.clear()
187
- await self.can_read.wait()
185
+ elif event is h11.PAUSED:
186
+ await self.can_read.clear()
187
+ await self.can_read.wait()
188
188
 
189
- elif isinstance(event, h11.ConnectionClosed) or event is h11.NEED_DATA:
190
- break
189
+ elif isinstance(event, h11.ConnectionClosed) or event is h11.NEED_DATA:
190
+ break
191
191
 
192
- elif self.stream is None:
193
- break
192
+ elif self.stream is None:
193
+ break
194
194
 
195
- elif isinstance(event, h11.Data):
196
- await self.stream.handle(Body(stream_id=STREAM_ID, data=event.data))
195
+ elif isinstance(event, h11.Data):
196
+ await self.stream.handle(Body(stream_id=STREAM_ID, data=event.data))
197
197
 
198
- elif isinstance(event, h11.EndOfMessage):
199
- await self.stream.handle(EndBody(stream_id=STREAM_ID))
198
+ elif isinstance(event, h11.EndOfMessage):
199
+ await self.stream.handle(EndBody(stream_id=STREAM_ID))
200
200
 
201
- elif isinstance(event, Data):
202
- # WebSocket pass through
203
- await self.stream.handle(event)
201
+ elif isinstance(event, Data):
202
+ # WebSocket pass through
203
+ await self.stream.handle(event)
204
204
 
205
205
  async def _create_stream(self, request: h11.Request) -> None:
206
206
  upgrade_value = ''
@@ -229,6 +229,7 @@ class H11Protocol(Protocol):
229
229
  STREAM_ID,
230
230
  )
231
231
  self.connection = H11WsConnection(ta.cast(h11.Connection, self.connection))
232
+
232
233
  else:
233
234
  self.stream = HttpStream(
234
235
  self.app,
@@ -255,6 +256,7 @@ class H11Protocol(Protocol):
255
256
  raw_path=request.target,
256
257
  ),
257
258
  )
259
+
258
260
  self.keep_alive_requests += 1
259
261
  await self.context.mark_request()
260
262
 
@@ -283,6 +285,7 @@ class H11Protocol(Protocol):
283
285
 
284
286
  async def _maybe_recycle(self) -> None:
285
287
  await self._close_stream()
288
+
286
289
  if (
287
290
  not self.context.terminated.is_set()
288
291
  and self.connection.our_state is h11.DONE
@@ -297,6 +300,7 @@ class H11Protocol(Protocol):
297
300
  self.scope = None
298
301
  await self.can_read.set()
299
302
  await self.send(Updated(idle=True))
303
+
300
304
  else:
301
305
  await self.can_read.set()
302
306
  await self.send(Closed())
@@ -316,7 +320,7 @@ class H11Protocol(Protocol):
316
320
  elif sanitised_name in {'content-length', 'transfer-encoding'}:
317
321
  has_body = True
318
322
 
319
- # h2c Upgrade requests with a body are a pain as the body must be fully recieved in HTTP/1.1 before the upgrade
323
+ # h2c Upgrade requests with a body are a pain as the body must be fully received in HTTP/1.1 before the upgrade
320
324
  # response and HTTP/2 takes over, so Hypercorn ignores the upgrade and responds in HTTP/1.1. Use a preflight
321
325
  # OPTIONS request to initiate the upgrade if really required (or just use h2).
322
326
  if upgrade_value.lower() == 'h2c' and not has_body:
@@ -138,13 +138,16 @@ class H2Protocol(Protocol):
138
138
  self.connection.initiate_upgrade_connection(settings)
139
139
  else:
140
140
  self.connection.initiate_connection()
141
+
141
142
  await self._flush()
143
+
142
144
  if headers is not None:
143
145
  event = h2.events.RequestReceived()
144
146
  event.stream_id = 1
145
147
  event.headers = headers
146
148
  await self._create_stream(event)
147
149
  await self.streams[event.stream_id].handle(EndBody(stream_id=event.stream_id))
150
+
148
151
  self.task_spawner.spawn(self.send_task)
149
152
 
150
153
  async def send_task(self) -> None:
@@ -178,6 +181,7 @@ class H2Protocol(Protocol):
178
181
  await self._flush()
179
182
  del self.stream_buffers[stream_id]
180
183
  self.priority.remove_stream(stream_id)
184
+
181
185
  except (h2.exceptions.StreamClosedError, KeyError, h2.exceptions.ProtocolError):
182
186
  # Stream or connection has closed whilst waiting to send data, not a problem - just force close it.
183
187
  await self.stream_buffers[stream_id].close()
@@ -316,6 +320,7 @@ class H2Protocol(Protocol):
316
320
  weight=event.weight,
317
321
  exclusive=event.exclusive,
318
322
  )
323
+
319
324
  except priority.MissingStreamError:
320
325
  # Received PRIORITY frame before HEADERS frame
321
326
  self.priority.insert_stream(
@@ -345,6 +350,7 @@ class H2Protocol(Protocol):
345
350
  self.stream_send,
346
351
  request.stream_id,
347
352
  )
353
+
348
354
  else:
349
355
  self.streams[request.stream_id] = HttpStream(
350
356
  self.app,
@@ -356,7 +362,9 @@ class H2Protocol(Protocol):
356
362
  self.stream_send,
357
363
  request.stream_id,
358
364
  )
365
+
359
366
  self.stream_buffers[request.stream_id] = StreamBuffer(self.context.event_class)
367
+
360
368
  try:
361
369
  self.priority.insert_stream(request.stream_id)
362
370
  except priority.DuplicateStreamError:
@@ -372,16 +380,21 @@ class H2Protocol(Protocol):
372
380
  method=method,
373
381
  raw_path=raw_path,
374
382
  ))
383
+
375
384
  self.keep_alive_requests += 1
376
385
  await self.context.mark_request()
377
386
 
378
387
  async def _create_server_push(
379
- self, stream_id: int, path: bytes, headers: list[tuple[bytes, bytes]],
388
+ self,
389
+ stream_id: int,
390
+ path: bytes,
391
+ headers: list[tuple[bytes, bytes]],
380
392
  ) -> None:
381
393
  push_stream_id = self.connection.get_next_available_stream_id()
382
394
  request_headers = [(b':method', b'GET'), (b':path', path)]
383
395
  request_headers.extend(headers)
384
396
  request_headers.extend(response_headers(self.config, 'h2'))
397
+
385
398
  try:
386
399
  self.connection.push_stream(
387
400
  stream_id=stream_id,
@@ -389,9 +402,11 @@ class H2Protocol(Protocol):
389
402
  request_headers=request_headers,
390
403
  )
391
404
  await self._flush()
405
+
392
406
  except h2.exceptions.ProtocolError:
393
407
  # Client does not accept push promises or we are trying to push on a push promises request.
394
408
  pass
409
+
395
410
  else:
396
411
  event = h2.events.RequestReceived()
397
412
  event.stream_id = push_stream_id
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: omserv
3
- Version: 0.0.0.dev25
3
+ Version: 0.0.0.dev26
4
4
  Summary: omserv
5
5
  Author: wrmsr
6
6
  License: BSD-3-Clause
@@ -12,7 +12,7 @@ Classifier: Operating System :: OS Independent
12
12
  Classifier: Operating System :: POSIX
13
13
  Requires-Python: ~=3.12
14
14
  License-File: LICENSE
15
- Requires-Dist: omlish ==0.0.0.dev25
15
+ Requires-Dist: omlish ==0.0.0.dev26
16
16
  Provides-Extra: all
17
17
  Requires-Dist: h11 ~=0.14 ; extra == 'all'
18
18
  Requires-Dist: h2 ~=4.1 ; extra == 'all'
@@ -11,11 +11,11 @@ omserv/apps/routes.py,sha256=shcN8qCSF2YoKal7nk-lemCAK3RX8MuHgNHhq_CTnh0,3762
11
11
  omserv/apps/sessions.py,sha256=glruQSbOSbCYLPp6nDRNSHCyp5hj4oiOPhh3R0F9BTM,1537
12
12
  omserv/apps/templates.py,sha256=PBRZHIF9UbnFnq-4EC6RmPeRkeH8lCBbpJkSdseHs6A,2125
13
13
  omserv/nginx/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- omserv/nginx/build.py,sha256=mCvX7f1LGguLNPVQEwxlWO6OQpad43JbLu96gbIlNy4,3141
14
+ omserv/nginx/build.py,sha256=EqxlDdL_-GyBj1BtqlmobTwvvSTIAmzT_Bt7pWlaqDI,3141
15
15
  omserv/nginx/configs.py,sha256=4oQDcKJKIatRG621qiZCYTayJI3-vv63TtRCiUxEVWI,2008
16
16
  omserv/nginx/stubstatus.py,sha256=_VnXZdXxSA7jIelYSwJLf9mOnt_UOvpWghAPWtlWSLw,1857
17
17
  omserv/nginx/patches/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
- omserv/nginx/patches/nginx-1.27.0_http_status.patch,sha256=bEDSczpBLcdjcBp_X1m73oxvt8KPeons7v_sUxqBSXM,4335
18
+ omserv/nginx/patches/nginx-1.27.1_http_status.patch,sha256=bEDSczpBLcdjcBp_X1m73oxvt8KPeons7v_sUxqBSXM,4335
19
19
  omserv/node/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
20
  omserv/node/models.py,sha256=XsfAI-LjlRkRfK0_ofh-gai5IUq_g357UfThK9dZ0UM,1258
21
21
  omserv/node/registry.py,sha256=0hodmyQn3POOZJBG8zTr9ojR80-ZNmIwJpQbchJg8EM,3459
@@ -36,8 +36,8 @@ omserv/server/types.py,sha256=XXY5py8RYlEeD4FZrWNqSyX7DD-ffSlcG-T2s9BY9eI,2017
36
36
  omserv/server/workercontext.py,sha256=4rcLuGsyiU7URO7T_eHylOBPPNUS9C23QfEUVyJUtIY,1200
37
37
  omserv/server/workers.py,sha256=rdV8qEzWKMZ6HnN9nUoGS58U9LRsrsqOcAd_7yl73Y0,6586
38
38
  omserv/server/protocols/__init__.py,sha256=Ryu2PDZ1TUI6F2l-HBEYgyzZ7wHqE6VmjqnS0tIvmQI,47
39
- omserv/server/protocols/h11.py,sha256=ctakfp8fyI2opzIWzwV1FGlnJlWL3QkMABp-qoPYFXI,12050
40
- omserv/server/protocols/h2.py,sha256=pClkPlaX0WnQ1dKee7Fvr4csSH2bBqItTcsKVuk1p1Q,15297
39
+ omserv/server/protocols/h11.py,sha256=_q_paD-ff0AWJEPaNK-6MUsQVtYRiALnWGwFyM3D0KU,11976
40
+ omserv/server/protocols/h2.py,sha256=bC-qmRQqgLASL1DtF3UX1ozximHH4xtae1d_vN2PffY,15345
41
41
  omserv/server/protocols/protocols.py,sha256=1ky8PGYIIR8wco6fcw-41RmHW-Kz_cNcZZoOqi7btNk,2790
42
42
  omserv/server/protocols/types.py,sha256=OXt5U3LsBToDxT7ipfFGiIHJU0WVvlfT6QQacF-_Plc,440
43
43
  omserv/server/resources/__init__.py,sha256=KppZbvZBKX1TdyaQZYY92oEKpdB3nuUXxharAgrbAIA,193
@@ -46,8 +46,8 @@ omserv/server/streams/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
46
46
  omserv/server/streams/httpstream.py,sha256=0DeiAPLGbEGNa0fHTs8lUpi_CFZs4M5_QB-TiS8mobQ,8015
47
47
  omserv/server/streams/utils.py,sha256=aMOrqWIg_Hht5W4kLg3y7oR5AEkVvMrZhyjzo6U5owE,1527
48
48
  omserv/server/streams/wsstream.py,sha256=3Vyzox7dCE1tDSXjb6xBubWo41ZF9d38Hrsrlj6h1J8,15482
49
- omserv-0.0.0.dev25.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
50
- omserv-0.0.0.dev25.dist-info/METADATA,sha256=65c61CuYjTA6ag094L-GdCJXShj0YcJNfbUWRK4B18Y,881
51
- omserv-0.0.0.dev25.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
52
- omserv-0.0.0.dev25.dist-info/top_level.txt,sha256=HXehpnxeKscKNULzKNzZ27oNawBrsh1PaNAirbX-XNA,7
53
- omserv-0.0.0.dev25.dist-info/RECORD,,
49
+ omserv-0.0.0.dev26.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
50
+ omserv-0.0.0.dev26.dist-info/METADATA,sha256=uPso6n4Vhuuf8A55kGst-irKK2LFtN9orHnO3FpEabc,881
51
+ omserv-0.0.0.dev26.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
52
+ omserv-0.0.0.dev26.dist-info/top_level.txt,sha256=HXehpnxeKscKNULzKNzZ27oNawBrsh1PaNAirbX-XNA,7
53
+ omserv-0.0.0.dev26.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.1.2)
2
+ Generator: setuptools (75.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5