| From: | Célestin Matte <celestin(dot)matte(at)cmatte(dot)me> |
|---|---|
| To: | Magnus Hagander <magnus(at)hagander(dot)net>, PostgreSQL WWW <pgsql-www(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: [PATCH] pgarchives: Fix crash when receiving a request with an incorrect If-Modified-Since header |
| Date: | 2026-09-09 15:09:52 |
| Message-ID: | dd797650-578b-45fe-a4b2-f2a99f55b478@cmatte.me |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-www |
I overlooked that the same issue arose in the message_flat() case. A bot made me notice.
Patch attached
On 12/06/2026 12:25, Magnus Hagander wrote:
>
>
> On Fri, 12 Jun 2026 at 10:52, Célestin Matte <celestin(dot)matte(at)cmatte(dot)me <mailto:celestin(dot)matte(at)cmatte(dot)me>> 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 = 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.
>
>
> Good catch. Applied. Thanks!
>
>
> (For some reason, archives on postgresql.org <http://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)
>
>
> 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.
>
> --
> Magnus Hagander
> Me: https://www.hagander.net/ <http://www.hagander.net/>
> Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/>
--
Célestin Matte
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Another-fix-for-receiving-a-request-with-an-incorrec.patch | text/x-patch | 1.1 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | vignesh C | 2026-09-10 05:56:55 | Editor access to wiki |
| Previous Message | Noah Misch | 2026-09-09 02:47:29 | wiki login expiration |