예제 #1
0
파일: fcgi-utils.c 프로젝트: michals/sx
void send_error(int errnum, const char *message) {
    if(!message || !*message)
	message = http_err_str(errnum);

    if(!is_sky()) {
        print_html(errnum, "Error", errnum, message);
    } else {
	CGI_PRINTF("Status: %d\r\nContent-Type: application/json\r\n", errnum);
        if (verb == VERB_HEAD) {
            /* workaround for old curl: it would close (instead of reusing)
             * the connection if a HEAD doesn't have Content-Length/chunked
             * encoding. And then we run out of ports due to too many
             * TIME_WAIT connections */
            CGI_PUTS("Content-Length: 0\r\n\r\n");
        } else {
            CGI_PUTS("\r\n");
            send_error_helper('{',errnum,message);
        }
    }
}
예제 #2
0
파일: fcgi-utils.c 프로젝트: s3v3ns/sx
void send_partial_error(const char *message, rc_ty rc) {
    char *reason = *msg_get_reason() ? strdup(msg_get_reason()) : NULL;
    msg_set_reason("%s: %s", message, reason ? reason : rc2str(rc));
    free(reason);
    send_error_helper(',', 500, msg_get_reason());
}
예제 #3
0
파일: fcgi-utils.c 프로젝트: michals/sx
void send_partial_error(const char *message, rc_ty rc) {
    msg_set_reason("%s: %s", message, rc2str(rc));
    send_error_helper(',', 500, rc2str(rc));
}