Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wXz4z-003bQC-21 for pgsql-www@arkaria.postgresql.org; Fri, 12 Jun 2026 10:25:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wXz4y-001rqL-16 for pgsql-www@arkaria.postgresql.org; Fri, 12 Jun 2026 10:25:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wXz4y-001rpy-0E for pgsql-www@lists.postgresql.org; Fri, 12 Jun 2026 10:25:36 +0000 Received: from mail-yx1-xb134.google.com ([2607:f8b0:4864:20::b134]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wXz4v-00000002hx6-2jTB for pgsql-www@lists.postgresql.org; Fri, 12 Jun 2026 10:25:35 +0000 Received: by mail-yx1-xb134.google.com with SMTP id 956f58d0204a3-65eb226b1ceso757609d50.0 for ; Fri, 12 Jun 2026 03:25:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1781259931; cv=none; d=google.com; s=arc-20240605; b=k9xdyBywb1XuEgY2vWu7zruptjMSpkgyZREi5DXmztcOFre0gzahzJlqYM7XWajzKg oM97lIbZ9mWZIv2S6Z25PA1DoQ9RxLP37awsdBb9sCHh7mh4vUOHX1N4TzrFvVkJtQJW Awtvsvt9Xq0OD3VSzfSzhvm4icXcu5XC9qxZnIYPB8n+JUtrjYtu/b3XPp98mVn/5n48 hMwCiKBRoAxYWr4bmiFhvVu5kI1lhPjmpsPnDlKQxypp0clVFn55HUXB4YYACnkgC9w6 0febnTGgbNqcTDE/ysZOyHjRH+VPLkZfzQ4bZC30AWLhRJAlFlcE4tq/PYt9y2hy79AK CvtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=aCBHcHagtf1nq8Rt5tfeytEDaIgyMhgNLpGk9la10ho=; fh=efBZOFRL5QBUgxP47RDABeUcD/2I8tpridOo6crUQMg=; b=RBOf9p17DcRPHK8FkPtHb4C9VduULyIp4B0FVbAYLY1obXJ3JbJbgdP4a/XSsFhIW1 lZH+RrYitTGd1WKDkL40iPSswgfDm2wNFMQJ+Nm9sV1/6ppl5zN3b/nDUUKxyvICBHyf OgFBd2JmFlD/xDzyFZJhCjZ2WBZFykJjx8LaqX2ZjKk0omtOHGyvZilOuqjKob7K4l5C jTiV5jSMGb+MXqqhFcvq+mUdw7lvfwCiyB7WgRnOL7n+uPFcdnqzggrXUA18zWc2OhkS 6K7B4GkIyZOWBtAkyCun6M5xDzWcSYP6aLOS4Tf7o4JWKTSXmzDSK8h2nXgZ6dd9qM0Z j/7Q==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hagander.net; s=mail; t=1781259931; x=1781864731; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=aCBHcHagtf1nq8Rt5tfeytEDaIgyMhgNLpGk9la10ho=; b=hyHDmxjYbZRiWTCskWzJ2Xf/yY4Voi7Uwrwt3gK+6XSNrGCq4mLXPQ/H1ED7wQuEbV yjXVKfO+Mp6olJDME5BrJp6XXIEOuqxZPhHi0lRjCHjUkLkPxpBvIteHLo8YZm2YO2tL EIxICnb0sAZ/J0k2jW2bBXgkiyRiaD20UJF8z8TOmuIstg8ZznTD16FevWS/X/K7692e KwyNA3d7VMEkxxJCwmmu5sybRdL1VTf1cWemDxtwvTKJPTrdCyGhkiHT0Ssmwg6/kyNZ 21uRcvdEI8GO5oVcQqDh8MyAZlXUbfxdv+jk+lMHgcRHNFO1wHyZ/TUndDIDLCeblRGR jKZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781259931; x=1781864731; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=aCBHcHagtf1nq8Rt5tfeytEDaIgyMhgNLpGk9la10ho=; b=oQFhshmBVO+T8/zV6OuUkgNIPIgw2BLnbvpmt7CgSXSSEK83EnY/ct61hnTWE8Rpbm kIMHK4BMMBGqGtcGos3WWTxAEoDefxKFQMMLEnzRX+ZbOPDJ80m2M7hwzVSMhUE2GSD7 GXSzsyZC4NFlaC9jNHDyqJpoz8Yd9zSYfv0n8+jOGfu9h57VPSkqm6gniSgVDgaWO/S6 aoZbCAUXgsQm7RBmPqkpugJ+7pD36AN0o1AsoloGTKwQpcvD2Qv1CwvjJUcIT6W8Pxpl 6potCpbCrbfDXyTLsR2yNea+BHYej18af7QndFlIMRP8NpBwB2kSgEgNRvUJqLJZmn3h lB7Q== X-Gm-Message-State: AOJu0YyVOPFYwiShJZy2udwMmn7qZumiKoAdvmEt+Hdk4lXSdPNuevgc KP72vdgmqAFkZZIY7I8/xb3I2dw90fWSwCihhRE1efZY0t+ba4YmvQGKs/YK0HZtAkB+7d3H641 f5wHjiLFy6O6PNWj97paMxBFM7JwZiM4Ips4+S5UfnsvVJ9j/Aa15pg== X-Gm-Gg: Acq92OG4H7RgZPZF3rbKZ5xcmK35iYv6NndSl1G6Hx2OQxlrzQwYLtVKe1JzpWPo9DB 1zVCRrt9nmHpRYPOi2w2lmKxXgHWyGov2p3m8d2/a7uYvxfXi3JmPY/wtDL8UhcVG5HFkgeghGX EN0vnZyub+Dmx8pmkuAVjmeo2XHAj8lDQMorD7srkljIfH6bzD71cjjU6PQgdkbpUwfx8P12pCw F2gILsXih/8WfSCMRVtYAgr8aRE3mN51EoXwicvvS/mWIjX2FoUysF6YKPowgC5dRaUbvFKiZEv n6tgWrU3WbJASEiFo2iJe2kp8WSIVbvSbGvYnK02 X-Received: by 2002:a05:690e:e8e:b0:65e:5110:a60d with SMTP id 956f58d0204a3-6627836017cmr1497200d50.50.1781259931327; Fri, 12 Jun 2026 03:25:31 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Magnus Hagander Date: Fri, 12 Jun 2026 12:25:19 +0200 X-Gm-Features: AVVi8CfDqyN1I2S6lPfzidZbini9ZSz6loCw8Y61UWFLlpY5cAxb2TFsbNTQFZI Message-ID: Subject: Re: [PATCH] pgarchives: Fix crash when receiving a request with an incorrect If-Modified-Since header To: =?UTF-8?Q?C=C3=A9lestin_Matte?= Cc: PostgreSQL WWW Content-Type: multipart/alternative; boundary="00000000000075aa7a06540be596" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000075aa7a06540be596 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 12 Jun 2026 at 10:52, C=C3=A9lestin Matte wrote: > Django crashes when receiving a request containing a If-Modified-Since > header with an incorrect date: > > > Traceback (most recent call last): > File > "/path/lib/python3.13/site-packages/django/core/handlers/exception.py", > line 55, in inner > response =3D get_response(request) > ^^^^^^^^^^^^^^^^^^^^^ > File > "/path/lib/python3.13/site-packages/django/core/handlers/base.py", line > 197, in _get_response > response =3D wrapped_callback(request, *callback_args, > **callback_kwargs) > > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/path/archives/mailarchives/views.py", line 112, in __cache > resp =3D fn(request, *_args, **_kwargs) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/path/archives/mailarchives/views.py", line 500, in message > if ims >=3D newest: > ^^^^^^^^^^^^^ > > Exception Type: TypeError at /message-id/ > Exception Value: '>=3D' not supported between instances of 'NoneType' and > 'int' > > > This patch adds a condition to avoid this. > Good catch. Applied. Thanks! > > (For some reason, archives on postgresql.org do NOT crash on this. Are > headers filtered before reaching pgarchives there? When deploying upstrea= m > version of pgarchives locally, I do have this crash) > IMS in particular is handled by the cache. So the brwoser does IMS <-> the cache, and then varnish does it independently <-> backend. And Varnish will always create the correct headers. And since headers from the client are never passed through to the backend, it doesn't show up there. --=20 Magnus Hagander Me: https://www.hagander.net/ Work: https://www.redpill-linpro.com/ --00000000000075aa7a06540be596 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Fri, 12 Jun = 2026 at 10:52, C=C3=A9lestin Matte <celestin.matte@cmatte.me> wrote:
Django crashes when receiving a request co= ntaining a If-Modified-Since header with an incorrect date:


Traceback (most recent call last):
=C2=A0 =C2=A0 File "/path/lib/python3.13/site-packages/django/core/han= dlers/exception.py", line 55, in inner
=C2=A0 =C2=A0 =C2=A0 response =3D get_response(request)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0^^^^^^^^^^^^^= ^^^^^^^^
=C2=A0 =C2=A0 File "/path/lib/python3.13/site-packages/django/core/han= dlers/base.py", line 197, in _get_response
=C2=A0 =C2=A0 =C2=A0 response =3D wrapped_callback(request, *callback_args,= **callback_kwargs)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0^^^^^^^^^^^^^= ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
=C2=A0 =C2=A0 File "/path/archives/mailarchives/views.py", line 1= 12, in __cache
=C2=A0 =C2=A0 =C2=A0 resp =3D fn(request, *_args, **_kwargs)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0^^^^^^^^^^^^^^^^^^^^^^^^^^^= ^^^
=C2=A0 =C2=A0 File "/path/archives/mailarchives/views.py", line 5= 00, in message
=C2=A0 =C2=A0 =C2=A0 if ims >=3D newest:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0^^^^^^^^^^^^^

Exception Type: TypeError at /message-id/<redacted>
Exception Value: '>=3D' not supported between instances of '= NoneType' and 'int'


This patch adds a condition to avoid this.

<= div>Good catch. Applied. Thanks!
=C2=A0

(For some reason, archives on postgresql.org do NOT crash on this. Are head= ers filtered before reaching pgarchives there? When deploying upstream vers= ion of pgarchives locally, I do have this crash)

<= /div>
IMS in particular is handled by the cache. So the brwoser does IM= S <-> the cache, and then varnish does it independently <-> bac= kend. And Varnish will always create the correct headers. And since headers= from the client are never passed through to the backend, it doesn't sh= ow up there.

=C2=A0
--
=C2=A0Magnus Hagander
=C2=A0Me: https://www.hagander.net/
=C2= =A0Work: https= ://www.redpill-linpro.com/
--00000000000075aa7a06540be596--