MIME type for CGI applications is always returned as text/html. #5

Closed
opened 2023-07-10 22:13:50 +01:00 by threeoh6000 · 0 comments
Owner

In detect_media_type(), CGI applications (denoted with a filename ending in .cgi) are automatically presumed to be text/html for MIME type purposes. This is because serve() wasn't built with the expectation of accommodating CGI applications and as a result uses detect_media_type() and the file extension of a file to infer the MIME type of a file even before get_page() is ran to either execute the CGI application or fetch the static file from the filesystem.

This is obviously very bad but also presents a compatibility problem with CGI applications that expect to be able to pass the MIME type of its data back to the server as well as CGI applications that pass any non-HTML data back to the server as the server will incorrectly tell the client that it is text/html when it isn't.

In `detect_media_type()`, CGI applications (denoted with a filename ending in `.cgi`) are automatically presumed to be text/html for MIME type purposes. This is because `serve()` wasn't built with the expectation of accommodating CGI applications and as a result uses `detect_media_type()` and the file extension of a file to infer the MIME type of a file even before `get_page()` is ran to either execute the CGI application or fetch the static file from the filesystem. This is obviously very bad but also presents a compatibility problem with CGI applications that expect to be able to pass the MIME type of its data back to the server as well as CGI applications that pass any non-HTML data back to the server as the server will incorrectly tell the client that it is text/html when it isn't.
threeoh6000 added the
bug
label 2023-07-10 22:14:18 +01:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: threeoh6000/herb#5
No description provided.