فهرست منبع

Merge branch 'master' of https://github.com/civetweb/civetweb

bel2125 4 سال پیش
والد
کامیت
dc22961e75
2فایلهای تغییر یافته به همراه24 افزوده شده و 1 حذف شده
  1. 9 0
      include/civetweb.h
  2. 15 1
      src/civetweb.c

+ 9 - 0
include/civetweb.h

@@ -1669,6 +1669,15 @@ CIVETWEB_API int
 mg_get_context_info(const struct mg_context *ctx, char *buffer, int buflen);
 
 
+/* Disable HTTP keep-alive on a per-connection basis.
+   Reference: https://github.com/civetweb/civetweb/issues/727
+   Parameters:
+     conn: Current connection handle.
+*/
+CIVETWEB_API void
+mg_disable_connection_keep_alive(struct mg_connection *conn);
+
+
 #if defined(MG_EXPERIMENTAL_INTERFACES)
 /* Get connection information. Useful for server diagnosis.
    Parameters:

+ 15 - 1
src/civetweb.c

@@ -10948,8 +10948,13 @@ static const struct mg_http_method_info http_methods[] = {
      * Section 9.1 of [RFC2616]). Responses to this
      * method MUST NOT be cached. */
 
+    /* Methods for write access to files on WEBDAV (RFC 2518) */
+    {"LOCK", 1, 1, 0, 0, 0},
+    {"UNLOCK", 1, 0, 0, 0, 0},
+    {"PROPPATCH", 1, 1, 0, 0, 0},
+
     /* Unsupported WEBDAV Methods: */
-    /* PROPPATCH, COPY, MOVE, LOCK, UNLOCK (RFC 2518) */
+    /* COPY, MOVE (RFC 2518) */
     /* + 11 methods from RFC 3253 */
     /* ORDERPATCH (RFC 3648) */
     /* ACL (RFC 3744) */
@@ -21181,6 +21186,15 @@ mg_get_context_info(const struct mg_context *ctx, char *buffer, int buflen)
 }
 
 
+void mg_disable_connection_keep_alive(struct mg_connection *conn)
+{
+  /* https://github.com/civetweb/civetweb/issues/727 */
+  if (conn != NULL) {
+    conn->must_close = 1;
+  }
+}
+
+
 #if defined(MG_EXPERIMENTAL_INTERFACES)
 /* Get connection information. It can be printed or stored by the caller.
  * Return the size of available information. */