Load plugins with RTLD_GLOBAL, fixes Lua library exports
[project/uhttpd.git] / relay.c
diff --git a/relay.c b/relay.c
index 5de5cb403df735f4bdfd1d7de6ed421a59305ce4..83664e60eb70605541ece0e0bc14e62a1e777025 100644 (file)
--- a/relay.c
+++ b/relay.c
@@ -76,6 +76,9 @@ static void relay_process_headers(struct relay *r)
                char *val;
 
                buf = ustream_get_read_buf(s, &len);
+               if (!buf || !len)
+                       break;
+
                newline = strchr(buf, '\n');
                if (!newline)
                        break;
@@ -130,6 +133,9 @@ static void relay_read_cb(struct ustream *s, int bytes)
        }
 
        buf = ustream_get_read_buf(s, &len);
+       if (!buf || !len)
+               return;
+
        uh_chunk_write(cl, buf, len);
        ustream_consume(s, len);
 }