#define MSHUTTINGDOWN(cm) ((cm->flags & ISC_HTTPDMGR_FLAGSHUTTINGDOWN) != 0)
#define MSETSHUTTINGDOWN(cm) (cm->flags |= ISC_HTTPDMGR_FLAGSHUTTINGDOWN)
-#ifdef DEBUG_HTTPD
-#define ENTER(x) do { fprintf(stderr, "ENTER %s\n", (x)); } while (0)
-#define EXIT(x) do { fprintf(stderr, "EXIT %s\n", (x)); } while (0)
-#define NOTICE(x) do { fprintf(stderr, "NOTICE %s\n", (x)); } while (0)
-#else
-#define ENTER(x) do { } while(0)
-#define EXIT(x) do { } while(0)
-#define NOTICE(x) do { } while(0)
-#endif
-
#define HTTP_RECVLEN 1024
#define HTTP_SENDGROW 1024
#define HTTP_SEND_MAXLEN 10240
return (result);
}
-static inline isc_result_t
+static inline void
httpd_socket_recv(isc_httpd_t *httpd, isc_region_t *region, isc_task_t *task)
{
isc_result_t result = ISC_R_SUCCESS;
if (result != ISC_R_SUCCESS) {
INSIST(isc_refcount_decrement(&httpd->references) > 1);
}
- return (result);
}
-static inline isc_result_t
+static inline void
httpd_socket_send(isc_httpd_t *httpd, isc_region_t *region, isc_task_t *task)
{
isc_result_t result = ISC_R_SUCCESS;
if (result != ISC_R_SUCCESS) {
INSIST(isc_refcount_decrement(&httpd->references) > 1);
}
- return (result);
}
isc_result_t
INSIST(MSHUTTINGDOWN(httpdmgr));
INSIST(ISC_LIST_EMPTY(httpdmgr->running));
- NOTICE("httpdmgr_destroy detaching socket, task, and timermgr");
-
isc_socket_detach(&httpdmgr->sock);
isc_task_detach(&httpdmgr->task);
httpdmgr->timermgr = NULL;
char *p;
int delim;
- ENTER("request");
-
httpd->recvlen += length;
httpd->recvbuf[httpd->recvlen] = 0;
&& ((httpd->flags & HTTPD_FOUNDHOST) == 0))
return (ISC_R_RANGE);
- EXIT("request");
-
return (ISC_R_SUCCESS);
}
static void
isc_httpd_accept(isc_task_t *task, isc_event_t *ev) {
- isc_result_t result;
isc_httpdmgr_t *httpdmgr = ev->ev_arg;
isc_httpd_t *httpd = NULL;
isc_region_t r;
REQUIRE(VALID_HTTPDMGR(httpdmgr));
- ENTER("accept");
-
LOCK(&httpdmgr->lock);
if (MSHUTTINGDOWN(httpdmgr)) {
- NOTICE("accept shutting down, goto out");
goto out;
}
if (nev->result == ISC_R_CANCELED) {
- NOTICE("accept canceled, goto out");
goto out;
}
if (nev->result != ISC_R_SUCCESS) {
/* XXXMLG log failure */
- NOTICE("accept returned failure, goto requeue");
goto requeue;
}
r.base = (unsigned char *)httpd->recvbuf;
r.length = HTTP_RECVLEN - 1;
- result = httpd_socket_recv(httpd, &r, task);
- if (result == ISC_R_SUCCESS) {
- NOTICE("accept queued recv on socket");
- }
+ httpd_socket_recv(httpd, &r, task);
requeue:
- result = httpdmgr_socket_accept(task, httpdmgr);
- if (result != ISC_R_SUCCESS) {
- NOTICE("accept could not reaccept due to failure");
- }
+ (void)httpdmgr_socket_accept(task, httpdmgr);
out:
UNLOCK(&httpdmgr->lock);
maybe_destroy_httpdmgr(httpdmgr);
isc_event_free(&ev);
-
- EXIT("accept");
}
static isc_result_t
REQUIRE(VALID_HTTPD(httpd));
- ENTER("recv");
-
INSIST(ISC_HTTPD_ISRECV(httpd));
if (sev->result != ISC_R_SUCCESS) {
- NOTICE("recv destroying client");
goto out;
}
out:
maybe_destroy_httpd(httpd);
isc_event_free(&ev);
- EXIT("recv");
}
void
*httpdmgrp = NULL;
REQUIRE(VALID_HTTPDMGR(httpdmgr));
- ENTER("isc_httpdmgr_shutdown");
-
LOCK(&httpdmgr->lock);
MSETSHUTTINGDOWN(httpdmgr);
maybe_destroy_httpdmgr(httpdmgr);
- EXIT("isc_httpdmgr_shutdown");
}
static isc_result_t
REQUIRE(VALID_HTTPD(httpd));
- ENTER("senddone");
INSIST(ISC_HTTPD_ISSEND(httpd));
isc_buffer_free(&httpd->sendbuffer);
b = &httpd->bodybuffer;
httpd->freecb(b, httpd->freecb_arg);
}
- NOTICE("senddone free callback performed");
}
if (sev->result != ISC_R_SUCCESS) {
ISC_HTTPD_SETRECV(httpd);
- NOTICE("senddone restarting recv on socket");
-
reset_client(httpd);
r.base = (unsigned char *)httpd->recvbuf;
out:
maybe_destroy_httpd(httpd);
isc_event_free(&ev);
- EXIT("senddone");
}
static void