[PATCH] pgarchives: Fix crash when receiving a request with an incorrect If-Modified-Since header

From: Célestin Matte <celestin(dot)matte(at)cmatte(dot)me>
To: PostgreSQL WWW <pgsql-www(at)lists(dot)postgresql(dot)org>
Subject: [PATCH] pgarchives: Fix crash when receiving a request with an incorrect If-Modified-Since header
Date: 2026-06-12 08:52:08
Message-ID: d72505be-f19c-47dd-bd3f-b7a55f421ba6@cmatte.me
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-www

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 = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/path/lib/python3.13/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/path/archives/mailarchives/views.py", line 112, in __cache
resp = fn(request, *_args, **_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/path/archives/mailarchives/views.py", line 500, in message
if ims >= newest:
^^^^^^^^^^^^^

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

This patch adds a condition to avoid this.

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

--
Célestin Matte

Attachment Content-Type Size
0001-Fix-crash-when-receiving-a-request-with-an-incorrect.patch text/x-patch 1.0 KB

Responses

Browse pgsql-www by date

  From Date Subject
Next Message Célestin Matte 2026-06-12 09:46:33 [PATCH] pglister: .gitlab-ci: move to Debian 13
Previous Message Anthony Sotolongo 2026-06-10 23:12:19 Re: Wiki editor request