FAQ  •  Register  •  Login

Include Last-Modified in HTTP response headers

<<

volley

Serviio newbie

Posts: 3

Joined: Sat Nov 17, 2018 6:33 pm

Post Sat Nov 17, 2018 7:08 pm

Include Last-Modified in HTTP response headers

Hi,

While fiddling with a new project involving a UPnP client I noticed that Serviio does not include the "Last-Modified" header in its HTTP responses.

This post is a feature request to have it included, when reasonable and feasible (e.g. for local files but perhaps not for external resources).

For reference, check out section 2.2 in RFC 7232. Snapshot:

https://tools.ietf.org/html/rfc7232#section-2.2

2.2. Last-Modified

The "Last-Modified" header field in a response provides a timestamp
indicating the date and time at which the origin server believes the
selected representation was last modified, as determined at the
conclusion of handling the request.

Last-Modified = HTTP-date

An example of its use is

Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT

2.2.1. Generation

An origin server SHOULD send Last-Modified for any selected
representation for which a last modification date can be reasonably
and consistently determined, since its use in conditional requests
and evaluating cache freshness ([RFC7234]) results in a substantial
reduction of HTTP traffic on the Internet and can be a significant
factor in improving service scalability and reliability.


To elaborate:
The code I am fiddling with scans the contents of the server and would in doing so like some means to figure out if a resource has changed since the last scan.
In that sense it would also be of interest to include a dc:date in UPnP ContentDirectory responses; it would spare one HTTP transaction per item in cases where no change has been made.
A HTTP ETag would also work. But neither dc:date nor ETags are part of this feature request. :)

Cheers,
volley
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Mon Nov 19, 2018 4:27 pm

Re: Include Last-Modified in HTTP response headers

Do you need it on the Browse response or when retrieving actual resource (file)?

The browse response already includes ETag
<<

volley

Serviio newbie

Posts: 3

Joined: Sat Nov 17, 2018 6:33 pm

Post Mon Nov 19, 2018 6:31 pm

Re: Include Last-Modified in HTTP response headers

zip wrote:Do you need it on the Browse response or when retrieving actual resource (file)?


Ah, good point! This is when retrieving an actual resource file.

Typical URL: http://192.168.1.x:8895/resource/3332/M ... 0/ORIGINAL

As a side note I just grabbed a fresh sample of the response headers (see below) and noticed the presence of "Cache-control: no-cache". I wonder if these are related, since if caching is not allowed there might be no point in including the Last-Modified. Out of curiousity (hi-jacking my own thread here :roll:), is the presence of no-cache intentional?

  Code:
null: HTTP/1.1 200 OK
Server: Windows_10 UPnP/1.0 DLNADOC/1.50 Serviio/1.10
transferMode.dlna.org: Streaming
Connection: close
realTimeInfo.dlna.org: DLNA.ORG_TLAG=*
Content-Length: 2409535
Date: Mon, 19 Nov 2018 18:22:32 GMT
Cache-control: no-cache
Content-Type: audio/mpeg
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Mon Nov 19, 2018 7:47 pm

Re: Include Last-Modified in HTTP response headers

yes it is. I don't remember why though. Probably some renderers having problems with reusing connections etc.
<<

volley

Serviio newbie

Posts: 3

Joined: Sat Nov 17, 2018 6:33 pm

Post Wed Nov 21, 2018 10:11 pm

Re: Include Last-Modified in HTTP response headers

zip wrote:yes it is. I don't remember why though. Probably some renderers having problems with reusing connections etc.


Aha! I guess that should be more related to the "Connection: close" header, but I guess renderers can also have problems with caching etc.

Before I drop the request, can you see any way forward where we can both have the cookie (=support legacy renderers) and eat it (=support caching and scanning)? I'm thinking configuration options, or a "known good" list of renderers that deal nicely with Last-Modified.

Return to Feature requests

Who is online

Users browsing this forum: No registered users and 13 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.