1 --- trunk/src/mod_proxy.c (revision 258)
2 +++ trunk/src/mod_proxy.c (revision 259)
4 log_error_write(srv, __FILE__, __LINE__, "sdsd",
5 "connect failed:", proxy_fd, strerror(errno), errno);
7 - proxy_connection_cleanup(srv, hctx);
16 -static int proxy_write_request(server *srv, handler_ctx *hctx) {
17 +static handler_t proxy_write_request(server *srv, handler_ctx *hctx) {
18 data_proxy *host= hctx->host;
23 if (-1 == (hctx->fd->fd = socket(r, SOCK_STREAM, 0))) {
24 log_error_write(srv, __FILE__, __LINE__, "ss", "socket failed: ", strerror(errno));
26 + return HANDLER_ERROR;
31 if (-1 == fdevent_fcntl_set(srv->ev, hctx->fd)) {
32 log_error_write(srv, __FILE__, __LINE__, "ss", "fcntl failed: ", strerror(errno));
34 - proxy_connection_cleanup(srv, hctx);
37 + return HANDLER_ERROR;
44 log_error_write(srv, __FILE__, __LINE__, "s", "(debug) unknown state");
46 + return HANDLER_ERROR;
50 + return HANDLER_GO_ON;
55 if (con->mode != p->id) return HANDLER_GO_ON;
57 /* ok, create the request */
58 - if (-1 == proxy_write_request(srv, hctx)) {
59 + switch(proxy_write_request(srv, hctx)) {
61 log_error_write(srv, __FILE__, __LINE__, "sbdd", "proxy-server disabled:",
66 host->disable_ts = srv->cur_ts;
68 + proxy_connection_cleanup(srv, hctx);
71 con->http_status = 503;
72 return HANDLER_FINISHED;
73 + case HANDLER_WAIT_FOR_EVENT:
74 + return HANDLER_WAIT_FOR_EVENT;
75 + case HANDLER_WAIT_FOR_FD:
76 + return HANDLER_WAIT_FOR_FD;
81 if (con->file_started == 1) {