+++ /dev/null
---- trunk/src/mod_proxy.c (revision 258)
-+++ trunk/src/mod_proxy.c (revision 259)
-@@ -365,8 +365,6 @@
- log_error_write(srv, __FILE__, __LINE__, "sdsd",
- "connect failed:", proxy_fd, strerror(errno), errno);
-
-- proxy_connection_cleanup(srv, hctx);
--
- return -1;
- }
- }
-@@ -615,7 +613,7 @@
- }
-
-
--static int proxy_write_request(server *srv, handler_ctx *hctx) {
-+static handler_t proxy_write_request(server *srv, handler_ctx *hctx) {
- data_proxy *host= hctx->host;
-
- int r;
-@@ -629,7 +627,7 @@
-
- if (-1 == (hctx->fd->fd = socket(r, SOCK_STREAM, 0))) {
- log_error_write(srv, __FILE__, __LINE__, "ss", "socket failed: ", strerror(errno));
-- return -1;
-+ return HANDLER_ERROR;
- }
-
- srv->cur_fds++;
-@@ -639,9 +637,7 @@
- if (-1 == fdevent_fcntl_set(srv->ev, hctx->fd)) {
- log_error_write(srv, __FILE__, __LINE__, "ss", "fcntl failed: ", strerror(errno));
-
-- proxy_connection_cleanup(srv, hctx);
--
-- return -1;
-+ return HANDLER_ERROR;
- }
-
- /* fall through */
-@@ -706,10 +702,10 @@
- break;
- default:
- log_error_write(srv, __FILE__, __LINE__, "s", "(debug) unknown state");
-- return -1;
-+ return HANDLER_ERROR;
- }
-
-- return 0;
-+ return HANDLER_GO_ON;
- }
-
- #define PATCH(x) \
-@@ -779,7 +775,8 @@
- if (con->mode != p->id) return HANDLER_GO_ON;
-
- /* ok, create the request */
-- if (-1 == proxy_write_request(srv, hctx)) {
-+ switch(proxy_write_request(srv, hctx)) {
-+ case HANDLER_ERROR:
- log_error_write(srv, __FILE__, __LINE__, "sbdd", "proxy-server disabled:",
- host->host,
- host->port,
-@@ -789,9 +786,17 @@
- host->usage = -1;
- host->disable_ts = srv->cur_ts;
-
-+ proxy_connection_cleanup(srv, hctx);
-+
- con->mode = DIRECT;
- con->http_status = 503;
- return HANDLER_FINISHED;
-+ case HANDLER_WAIT_FOR_EVENT:
-+ return HANDLER_WAIT_FOR_EVENT;
-+ case HANDLER_WAIT_FOR_FD:
-+ return HANDLER_WAIT_FOR_FD;
-+ default:
-+ break;
- }
-
- if (con->file_started == 1) {
+++ /dev/null
-output byte, instead of number if the request line contains invalid char
-
---- ../src/request.c~ 2005-04-19 19:05:00.000000000 +0300
-+++ ../src/request.c 2005-04-19 19:05:05.000000000 +0300
-@@ -450,12 +450,15 @@
- /* check uri for invalid characters */
- for (j = 0; j < con->request.uri->used - 1; j++) {
- if (!request_uri_is_valid_char(con->request.uri->ptr[j])) {
-+ unsigned char buf[2];
-+ buf[0] = con->request.uri->ptr[j];
-+ buf[1] = '\0';
-+
- con->http_status = 400;
- con->keep_alive = 0;
-
-- log_error_write(srv, __FILE__, __LINE__, "sd",
-- "invalid character in URI -> 400",
-- con->request.uri->ptr[j]);
-+ log_error_write(srv, __FILE__, __LINE__, "sss",
-+ "invalid character in URI", buf, "-> 400");
-
- if (srv->srvconf.log_request_header_on_error) {
- log_error_write(srv, __FILE__, __LINE__, "Sb",