uhttpd: recognize PATCH, PUT and DELETE HTTP methods
[project/uhttpd.git] / proc.c
diff --git a/proc.c b/proc.c
index edfcc8f33c6024e50a1c1bdfed51897d6f8aa20c..88ec31ea8caedff8b1cff5a85cdad2bfbe56f6bb 100644 (file)
--- a/proc.c
+++ b/proc.c
@@ -30,6 +30,7 @@
        __header(connection, connection) \
        __header(cookie, cookie) \
        __header(host, host) \
+       __header(origin, origin) \
        __header(referer, referer) \
        __header(user_agent, user-agent) \
        __header(content_type, content-type) \
@@ -63,6 +64,7 @@ static const struct {
        { "HTTP_CONNECTION", HDR_connection },
        { "HTTP_COOKIE", HDR_cookie },
        { "HTTP_HOST", HDR_host },
+       { "HTTP_ORIGIN", HDR_origin },
        { "HTTP_REFERER", HDR_referer },
        { "HTTP_USER_AGENT", HDR_user_agent },
        { "HTTP_X_HTTP_METHOD_OVERRIDE", HDR_x_http_method_override },
@@ -265,7 +267,6 @@ static void proc_write_cb(struct uloop_fd *fd, unsigned int events)
        struct client *cl = container_of(fd, struct client, dispatch.proc.wrfd);
 
        client_poll_post_data(cl);
-       cl->dispatch.data_blocked = false;
 }
 
 static void proc_relay_write_cb(struct client *cl)
@@ -292,10 +293,8 @@ static int proc_data_send(struct client *cl, const char *data, int len)
                        if (errno == EINTR)
                                continue;
 
-                       if (errno == EAGAIN || errno == EWOULDBLOCK) {
-                               cl->dispatch.data_blocked = true;
+                       if (errno == EAGAIN || errno == EWOULDBLOCK)
                                break;
-                       }
 
                        /* consume all data */
                        ret = len;
@@ -369,7 +368,6 @@ bool uh_create_process(struct client *cl, struct path_info *pi, char *url,
 
        proc->wrfd.fd = wfd[1];
        uh_relay_open(cl, &proc->r, rfd[0], pid);
-       uloop_fd_add(&proc->wrfd, ULOOP_WRITE);
 
        d->free = proc_free;
        d->close_fds = proc_close_fds;