summaryrefslogtreecommitdiffstats
path: root/app/df.php (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2019-03-24Employ df cache validation using HTTP ETag headerMalf Furious1-7/+17
This patch is a direct improvement on the previous one. Now, instead of telling clients to always cache df resources for 24 hours before revalidating the file, we tell them to cache it for zero seconds. This, in cobination with the ETag header, prompts the browser to utilize the If-None-Match request header. When serving df resources, we will set an ETag, which is a sha256 of the file content for the browser to cache. When the browser wants to load a resource a second time, it will send the ETag back via the If-None-Match header so we can compare it to the current file's hash. If the browser's ETag is still current, we can return 304 and save some bandwidth. Otherwise, the full response is sent as usual. Signed-off-by: Malf Furious <m@lfurio.us>
2019-03-23Instruct client to cache df.php resourcesMalf Furious1-1/+8
Since content served by df.php is inherently dynamic, the server wisely instructs clients to not cache any responses. In pratice, for Scrott, the resources accessible by df.php are usually static, perhaps only ocasionally appearing or disappearing. A consequence of this is that clients have to repeatedly download several images, often on each page load of the app. Low-bandwidth clients will especially feel this. This patch _explicitly_ inserts from headers into the response from df.php which instruct the client to keep a copy of the resource for 24 hours. The idea being that resource requests will be *drastically* reduced and if someone updates their head image (for example), that change will take no-more-than 1 day to propagate. Signed-off-by: Malf Furious <m@lfurio.us>
2019-03-21Update df.php to serve thumbnailsMalf Furious1-0/+4
df.php will now serve bg image thumbnails when d=thumbs. Normal access requirements stand. Signed-off-by: Malf Furious <m@lfurio.us>
2018-09-26df: Address class cyclic require loopMalf Furious1-0/+1
A dependency loop exists between class/agent.class.php and class/group.class.php. Due to specific `require_once` ordering within the app, this problem was not surfaced until now. These two classes depend on eachother, but strictly speaking, the interpreter needs to read the agent class first. This is because group directly inherits from agent. It is only one of agent's functions which references group. Group has a `require_once "class/agent.class.php"` at its top, so requiring group first will read both classes, in the correct order, and provide their definition's for the remainder of the runtime. The main entry-point, index.php, did not have this problem since it was explicitly requiring group itself (it actually needs group, though). The df.php entry-point wasn't and was relying on requires in the class/ directory to resolve this issue. In a more-sane language, I could patch this more easily directly in the affected file; rather, this patch updates the df entry-point to explicitly require group, solving the issue up front. Hopefully this can be fleshed out in the future as it should not consern the entry-points that this specific evaluation order needs to take place. The third and final entry-point, cron.php, is already fine at the time of this commit. Its require tree is much simplier, and does not even include either of the affected classes.
2018-02-07Update df script to use renamed obj classMalf Furious1-1/+1
2017-06-04Fix bug in function serveResource()Malf Furious1-1/+1
It is necessary to use double-quotes in the Content-Disposition header.
2017-06-04Update df script to support message attachmentsMalf Furious1-0/+6
Now, if a mesg guid is requested under attach/, the attachment file is served and offers the browser the content-disposition for that file.
2017-06-04Update df function serveResource()Malf Furious1-3/+7
Added optional parameter for resource's filename. If given, a Content-Disposition header will be delivered to the client.
2017-04-20Add dynamic file proxy scriptMalf Furious1-0/+102
Entry point df.php, meaning dynamic file or direct file, added as a means of serving user-supplied content while enforcing access-controls in PHP.