X-Git-Url: https://git.archive.openwrt.org/?p=openwrt.git;a=blobdiff_plain;f=package%2Fuhttpd%2Fsrc%2Fuhttpd.c;h=73f6e03bd47c980dfd1c46db03c288d96f280abb;hp=d5d5dfb982da4e059fbdc6b9d3ab6c0c9575881d;hb=c2e7896dea3b1834be3f35961da53dcfd2c61a04;hpb=fffc489ef420dcdf3130fa98523baefde41cc78f diff --git a/package/uhttpd/src/uhttpd.c b/package/uhttpd/src/uhttpd.c index d5d5dfb982..73f6e03bd4 100644 --- a/package/uhttpd/src/uhttpd.c +++ b/package/uhttpd/src/uhttpd.c @@ -219,7 +219,7 @@ static int uh_socket_bind(fd_set *serv_fds, int *max_fd, *max_fd = max(*max_fd, sock); l->fd.cb = uh_listener_cb; - uloop_fd_add(&l->fd, ULOOP_READ | ULOOP_WRITE); + uloop_fd_add(&l->fd, ULOOP_READ); bound++; continue; @@ -539,7 +539,7 @@ static void uh_listener_cb(struct uloop_fd *u, unsigned int events) if ((cl = uh_client_add(new_fd, serv)) != NULL) { /* add client socket to global fdset */ - uloop_fd_add(&cl->fd, ULOOP_READ | ULOOP_WRITE); + uloop_fd_add(&cl->fd, ULOOP_READ); #ifdef HAVE_TLS /* setup client tls context */ @@ -569,6 +569,15 @@ static void uh_listener_cb(struct uloop_fd *u, unsigned int events) } } +static void uh_pipe_cb(struct uloop_fd *u, unsigned int events) +{ + struct client *cl = container_of(u, struct client, pipe); + + D("SRV: Client(%d) pipe(%d) readable\n", cl->fd.fd, cl->pipe.fd); + + uh_client_cb(&cl->fd, ULOOP_WRITE); +} + static void uh_child_cb(struct uloop_process *p, int rv) { struct client *cl = container_of(p, struct client, proc); @@ -686,6 +695,15 @@ static void uh_client_cb(struct uloop_fd *u, unsigned int events) return; } + /* request handler spawned a pipe, register handler */ + if (cl->pipe.fd) + { + D("SRV: Client(%d) pipe(%d) spawned\n", u->fd, cl->pipe.fd); + + cl->pipe.cb = uh_pipe_cb; + uloop_fd_add(&cl->pipe, ULOOP_READ); + } + /* request handler spawned a child, register handler */ if (cl->proc.pid) { @@ -701,7 +719,6 @@ static void uh_client_cb(struct uloop_fd *u, unsigned int events) /* header processing complete */ D("SRV: Client(%d) dispatched\n", u->fd); cl->dispatched = true; - return; } if (!cl->cb(cl))