fix: correct error code

main
Sean McBride 4 years ago
parent e810d78561
commit 99d33c46cb

@ -10,7 +10,7 @@
#include "http.h" #include "http.h"
#define HTTP_RESPONSE_200_OK "HTTP/1.1 200 OK\r\n" #define HTTP_RESPONSE_200_OK "HTTP/1.1 200 OK\r\n"
#define HTTP_RESPONSE_504_SERVICE_UNAVAILABLE "HTTP/1.1 504 Service Unavailable\r\n\r\n" #define HTTP_RESPONSE_503_SERVICE_UNAVAILABLE "HTTP/1.1 503 Service Unavailable\r\n\r\n"
#define HTTP_RESPONSE_400_BAD_REQUEST "HTTP/1.1 400 Bad Request\r\n\r\n" #define HTTP_RESPONSE_400_BAD_REQUEST "HTTP/1.1 400 Bad Request\r\n\r\n"
#define HTTP_RESPONSE_CONTENT_LENGTH "Content-Length: " #define HTTP_RESPONSE_CONTENT_LENGTH "Content-Length: "
#define HTTP_RESPONSE_CONTENT_LENGTH_TERMINATOR "\r\n\r\n" /* content body follows this */ #define HTTP_RESPONSE_CONTENT_LENGTH_TERMINATOR "\r\n\r\n" /* content body follows this */

@ -162,10 +162,10 @@ listener_thread_reject(int client_socket)
int rc; int rc;
int sent = 0; int sent = 0;
int to_send = strlen(HTTP_RESPONSE_504_SERVICE_UNAVAILABLE); int to_send = strlen(HTTP_RESPONSE_503_SERVICE_UNAVAILABLE);
while (sent < to_send) { while (sent < to_send) {
rc = write(client_socket, &HTTP_RESPONSE_504_SERVICE_UNAVAILABLE[sent], to_send - sent); rc = write(client_socket, &HTTP_RESPONSE_503_SERVICE_UNAVAILABLE[sent], to_send - sent);
if (rc < 0) { if (rc < 0) {
if (errno == EAGAIN) continue; if (errno == EAGAIN) continue;

Loading…
Cancel
Save