Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

Commit

Permalink
Properly set error codes
Browse files Browse the repository at this point in the history
  • Loading branch information
lutoma committed May 11, 2012
1 parent 69fac3d commit 3bb5aaf
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions request.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,17 @@

#include <fcgiapp.h>

#define http_error(num) { FCGX_FPrintF(request->out, "\r\n\r\nError %d\n", num); }
#define http_error_c(num) { http_error(num); return; }
#define http_sendfile(file) { FCGX_FPrintF(request->out, "X-Accel-Redirect: /asset-send/%s\r\nGenerator: fastresize\r\n\r\n", file); }
static inline void http_error(FCGX_Request* request, int num) {
FCGX_FPrintF(request->out,
"Status: %d %s\r\n"
"Content-Type: text/html\r\n"
"\r\n"
"<h1>Error %d</h1>"
"<hr /><a href='https://github.com/lutoma/fastresize'>fastresize</a>",
num, num == 404 ? "Not found" : "Error", num);
}

#define http_error_c(num) { http_error(request, num); return; }
#define http_sendfile(file) { FCGX_FPrintF(request->out, "X-Accel-Redirect: /asset-send/%s\r\n\r\n", file); }

void handle_request(FCGX_Request* request, char* root);

0 comments on commit 3bb5aaf

Please sign in to comment.