Ticket #374 (closed defect: wontfix)
HTTP Response codes inaccurate
| Reported by: | anonymous | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | Community Related Issues |
| Component: | Core | Version: | 1.7.4 |
| Keywords: | Cc: | ||
| MoSCoW: | none | Estimated time after impact analysis: | |
| Related to project: | none | Tested: | no |
| Accepted: | no | Estimated Hours: |
Description
When a still image <vpx_still_url> is requested for the first time, it shows the still image. The HTTP response is:
HTTP/1.1 200 OK
Date: Fri, 08 Oct 2010 12:36:07 GMT
Server: Apache/2.2.3 (Red Hat)
X-Powered-By: PHP/5.2.10
Content-Length: 3480
Connection: close
Content-Type: image/jpeg
When a request is made to the same <vpx_still_url> for a second time, the still is not available anymore. The HTTP response is:
HTTP/1.1 200 OK
Date: Fri, 08 Oct 2010 12:39:51 GMT
Server: Apache/2.2.3 (Red Hat)
X-Powered-By: PHP/5.2.10
Content-Length: 14
Connection: close
Content-Type: text/html; charset=UTF-8
The body of the response is showing "File not found".
The HTTP response code should be 404 and not 200. This behaviour is wrong and is confusing client applications (caching for instance) and doesn't conform to REST principles. This happens everywhere where die() function is used.
I have added corresponding http response codes.
$/mediamosa/still/index.php
line: 15
die("Unable to connect to VPX");
replace with:
header("HTTP/1.1 500 Internal Server Error", false, 500);
die("Unable to connect to VPX");
line: 18
die("Invalid mountpoint received");
replace with:
header("HTTP/1.1 500 Internal Server Error", false, 500);
die("Invalid mountpoint received");
line: 31
die("Invalid parameter");
replace with:
header("HTTP/1.1 400 Bad Request", false, 400);
die("Invalid parameter");
line: 38
die("File not found");
replace with:
header("HTTP/1.1 404 Not Found", false, 404);
die("File not found");
$/mediamosa/download/index.php
line: 23
die("Unable to connect to VPX");
replace with:
header("HTTP/1.1 500 Internal Server Error", false, 500);
die("Unable to connect to VPX");
line: 26
die("Invalid mountpoint received");
replace with:
header("HTTP/1.1 500 Internal Server Error", false, 500);
die("Invalid mountpoint received");
line: 36
die("Invalid parameter");
replace with:
header("HTTP/1.1 400 Bad Request", false, 400);
die("Invalid parameter");
line: 42
die("Invalid download ticket");
replace with:
header("HTTP/1.1 404 Not Found", false, 404);
die("Invalid download ticket");
line: 49
die("File not found");
replace with:
header("HTTP/1.1 404 Not Found", false, 404);
die("File not found");
Running version 1.7.5 (missing in dropdown selection)
Bye, Tom Kuipers
