fastlifeweb 0.16.2__py3-none-any.whl → 0.16.3__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.
@@ -15,6 +15,17 @@ def get_header(headers: Sequence[Tuple[bytes, bytes]], key: bytes) -> Optional[s
15
15
  return None
16
16
 
17
17
 
18
+ def get_header_int(headers: Sequence[Tuple[bytes, bytes]], key: bytes) -> Optional[int]:
19
+ for hdr in headers:
20
+ if hdr[0].lower() == key:
21
+ ret = hdr[1].decode("latin1")
22
+ try:
23
+ return int(ret)
24
+ except ValueError:
25
+ pass
26
+ return None
27
+
28
+
18
29
  class XForwardedStar(AbstractMiddleware):
19
30
  def __init__(
20
31
  self,
@@ -26,7 +37,10 @@ class XForwardedStar(AbstractMiddleware):
26
37
  if scope["type"] in ("http", "websocket"):
27
38
  headers = scope["headers"]
28
39
  new_vals = {
29
- "client": get_header(headers, b"x-real-ip"),
40
+ "client": (
41
+ get_header(headers, b"x-real-ip"),
42
+ get_header_int(headers, b"x-forwarded-port"),
43
+ ),
30
44
  "host": get_header(headers, b"x-forwarded-host"),
31
45
  "scheme": get_header(headers, b"x-forwarded-proto"),
32
46
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fastlifeweb
3
- Version: 0.16.2
3
+ Version: 0.16.3
4
4
  Summary: High-level web framework
5
5
  Home-page: https://github.com/mardiros/fastlife
6
6
  License: BSD-derived
@@ -1676,7 +1676,7 @@ fastlife/config/views.py,sha256=Dxi6lO4gFs6GriAW7Rh5GDvebwbrpS2HzYhf30pXJiE,2058
1676
1676
  fastlife/middlewares/__init__.py,sha256=C3DUOzR5EhlAv5Zq7h-Abyvkd7bUsJohTRSB2wpRYQE,220
1677
1677
  fastlife/middlewares/base.py,sha256=9OYqByRuVoIrLt353NOedPQTLdr7LSmxhb2BZcp20qk,638
1678
1678
  fastlife/middlewares/reverse_proxy/__init__.py,sha256=g1SoVDmenKzpAAPYHTEsWgdBByOxtLg9fGx6RV3i0ok,846
1679
- fastlife/middlewares/reverse_proxy/x_forwarded.py,sha256=WC4xV3i6_Ogqsf_Zgt1ESml8zfnPbJJJkPlC2gTEqW8,1095
1679
+ fastlife/middlewares/reverse_proxy/x_forwarded.py,sha256=aq_80V0Vrb4M6RQfk8CtQnhfwZGzJyeTYYQ16In8DaQ,1510
1680
1680
  fastlife/middlewares/session/__init__.py,sha256=3XgXcIO6yQls5G7x8K2T8b7a_enA_7rQptWZcp3j2Ak,1400
1681
1681
  fastlife/middlewares/session/middleware.py,sha256=AlRIFXfn3JesKJzMAFUHDOo22mfuwDHkyecDHo9jCdA,3172
1682
1682
  fastlife/middlewares/session/serializer.py,sha256=fTdZCop0y4VkCMyOIo6GEbo5fVWrwsBXaSWfConPL8E,2144
@@ -1707,7 +1707,7 @@ fastlife/testing/__init__.py,sha256=vuqwoNUd3BuIp3fm7nkvmYkIGjIimf5zUGhDkeWrg2s,
1707
1707
  fastlife/testing/testclient.py,sha256=BC7lLQ_jc59UmknAKzgRtW9a3cpX_V_QLp9Mg2ScLA8,20546
1708
1708
  fastlife/views/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1709
1709
  fastlife/views/pydantic_form.py,sha256=ZYOXKudmSqtRvFn5ZY75DOXZVunGXJBKpjh9FJcqu6k,1386
1710
- fastlifeweb-0.16.2.dist-info/LICENSE,sha256=F75xSseSKMwqzFj8rswYU6NWS3VoWOc_gY3fJYf9_LI,1504
1711
- fastlifeweb-0.16.2.dist-info/METADATA,sha256=KIJVtDej45kFERanabt_3BzlEywJ274ZpWAHj3BGJm0,3345
1712
- fastlifeweb-0.16.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
1713
- fastlifeweb-0.16.2.dist-info/RECORD,,
1710
+ fastlifeweb-0.16.3.dist-info/LICENSE,sha256=F75xSseSKMwqzFj8rswYU6NWS3VoWOc_gY3fJYf9_LI,1504
1711
+ fastlifeweb-0.16.3.dist-info/METADATA,sha256=oKBtNXGfKC8ya3PoQYclQuJVP_UPZs4GzKmWUzt3_t8,3345
1712
+ fastlifeweb-0.16.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
1713
+ fastlifeweb-0.16.3.dist-info/RECORD,,