Skip to content

Commit

Permalink
Adding more places where headers missed
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Grady <[email protected]>
  • Loading branch information
1000TurquoisePogs committed Feb 22, 2019
1 parent 51377af commit fea5203
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions c/httpserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -3635,6 +3635,8 @@ void respondWithUnixFile2(HttpService* service, HttpResponse* response, char* ab

if (!modified) {
setResponseStatus(response, 304, "Not modified");
addStringHeader(response, "Cache-control", "no-store");
addStringHeader(response, "Pragma", "no-cache");
addStringHeader(response, "Server", "jdmfws");
addCacheRelatedHeaders(response, mtime, etag);
writeHeader(response);
Expand Down Expand Up @@ -3670,6 +3672,8 @@ void respondWithUnixFile2(HttpService* service, HttpResponse* response, char* ab

setResponseStatus(response,200,"OK");
addStringHeader(response,"Server","jdmfws");
addStringHeader(response, "Cache-control", "no-store");
addStringHeader(response, "Pragma", "no-cache");
addIntHeader(response,"Content-Length",fileSize); /* Is this safe post-conversion??? */
setContentType(response, mimeType);
addCacheRelatedHeaders(response, mtime, etag);
Expand Down Expand Up @@ -3753,6 +3757,8 @@ void respondWithUnixDirectory(HttpResponse *response, char* absolutePath, int js
fflush(stdout);
#endif
setResponseStatus(response,200,"OK");
addStringHeader(response, "Cache-control", "no-store");
addStringHeader(response, "Pragma", "no-cache");
addStringHeader(response,"Server","jdmfws");
addStringHeader(response,"Transfer-Encoding","chunked");
if (jsonMode == 0) {
Expand Down Expand Up @@ -3782,6 +3788,8 @@ void respondWithUnixFileNotFound(HttpResponse* response, int jsonMode) {
addStringHeader(response,"Server","jdmfws");
setContentType(response,"text/plain");
setResponseStatus(response,404,"Not Found");
addStringHeader(response, "Cache-control", "no-store");
addStringHeader(response, "Pragma", "no-cache");
addIntHeader(response,"Content-Length",len);
writeHeader(response);

Expand All @@ -3800,13 +3808,8 @@ void respondWithUnixFileNotFound(HttpResponse* response, int jsonMode) {
// Response must ALWAYS be finished on return
void respondWithJsonError(HttpResponse *response, char *error, int statusCode, char *statusMessage) {
jsonPrinter *out = respondWithJsonPrinter(response);

setContentType(response, "application/json");
setResponseStatus(response,statusCode,statusMessage);
addStringHeader(response, "Server", "jdmfws");
addStringHeader(response, "Transfer-Encoding", "chunked");
addStringHeader(response, "Cache-control", "no-store");
addStringHeader(response, "Pragma", "no-cache");
setDefaultJSONRESTHeaders(response);
writeHeader(response);

jsonStart(out);
Expand Down

0 comments on commit fea5203

Please sign in to comment.