瀏覽代碼

Fix issue #12: Handle post requests with Content-length 0 bytes

bel 11 年之前
父節點
當前提交
8683723244
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/civetweb.c

+ 2 - 2
src/civetweb.c

@@ -2163,8 +2163,8 @@ int mg_read(struct mg_connection *conn, void *buf, size_t len)
     int64_t n, buffered_len, nread;
     const char *body;
 
-    /* If Content-Length is not set, read until socket is closed */
-    if (conn->consumed_content == 0 && conn->content_len == 0) {
+    /* If Content-Length is not set for a PUT or POST request, read until socket is closed */
+    if (conn->consumed_content == 0 && conn->content_len == -1) {
         conn->content_len = INT64_MAX;
         conn->must_close = 1;
     }