|
|
@ -373,22 +373,24 @@ err:
|
|
|
|
int to_send = strlen(HTTP_RESPONSE_400_BAD_REQUEST);
|
|
|
|
int to_send = strlen(HTTP_RESPONSE_400_BAD_REQUEST);
|
|
|
|
int sent = 0;
|
|
|
|
int sent = 0;
|
|
|
|
while (sent < to_send) {
|
|
|
|
while (sent < to_send) {
|
|
|
|
rc = write(sandbox->client_socket_descriptor, HTTP_RESPONSE_400_BAD_REQUEST,
|
|
|
|
rc = write(sandbox->client_socket_descriptor, &HTTP_RESPONSE_400_BAD_REQUEST[sent], to_send - sent);
|
|
|
|
strlen(HTTP_RESPONSE_400_BAD_REQUEST));
|
|
|
|
|
|
|
|
if (rc < 0) {
|
|
|
|
if (rc < 0) {
|
|
|
|
if (errno == EAGAIN) continue;
|
|
|
|
if (errno == EAGAIN) continue;
|
|
|
|
|
|
|
|
|
|
|
|
debuglog("Failed to send 400: %s", strerror(errno));
|
|
|
|
debuglog("Failed to send 400: %s", strerror(errno));
|
|
|
|
if (close(sandbox->client_socket_descriptor) < 0) panic("Failed to close socket!\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sent += rc;
|
|
|
|
sent += rc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef LOG_TOTAL_REQS_RESPS
|
|
|
|
#ifdef LOG_TOTAL_REQS_RESPS
|
|
|
|
|
|
|
|
if (rc >= 0) {
|
|
|
|
runtime_total_4XX_responses++;
|
|
|
|
runtime_total_4XX_responses++;
|
|
|
|
debuglog("At %llu, Sandbox %lu - 4XX\n", __getcycles(), sandbox->request_arrival_timestamp);
|
|
|
|
debuglog("At %llu, Sandbox %lu - 4XX\n", __getcycles(), sandbox->request_arrival_timestamp);
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
software_interrupt_disable();
|
|
|
|
software_interrupt_disable();
|
|
|
|
sandbox_close_http(sandbox);
|
|
|
|
sandbox_close_http(sandbox);
|
|
|
|
sandbox_set_as_error(sandbox, SANDBOX_RUNNING);
|
|
|
|
sandbox_set_as_error(sandbox, SANDBOX_RUNNING);
|
|
|
|