libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] Duplicate Content-Length headers set by MHD & applicatio


From: Rob Kingston
Subject: [libmicrohttpd] Duplicate Content-Length headers set by MHD & application
Date: Sun, 20 Feb 2022 13:23:08 +1100

Hi there,

Kodi uses MHD for its web interface and JSON API. A recent update on MHD has changed Content-Length headers to be set automatically without throwing any errors or overriding the existing headers when present. 

This results in the header being set twice when the application inadvertently sets it. E.g. resulting in headers like:

HTTP/1.1 200 OK
Date: Sat, 19 Feb 2022 23:59:56 GMT
Accept-Ranges: none
Cache-Control: private, max-age=0, no-cache
Content-Length: 649
Content-Type: application/json
Content-Length: 649

Unfortunately, some useragents reject responses where this is set multiple times. Python's aiohttp library is one such useragent that breaks due to this.

There's discussion about handling this in Kodi by conditionally setting the Content-Length headers depending on the version of MHD being run. However it looks like MHD has also recently handled such cases before too:

https://github.com/Karlson2k/libmicrohttpd/commit/16ac89f3beb982dab4f1552ffb94e637b45ca324

What is the best way to handle this going forward?

Cheers,
Rob


reply via email to

[Prev in Thread] Current Thread [Next in Thread]