Răsfoiți Sursa

add Connection section when using module

zhaohengbo 7 ani în urmă
părinte
comite
89ac722b47
1 a modificat fișierele cu 19 adăugiri și 0 ștergeri
  1. 19 0
      src/wn_module.c

+ 19 - 0
src/wn_module.c

@@ -349,6 +349,25 @@ int webnet_module_system_dofile(struct webnet_session *session)
                           "Content-Length: %ld\r\n",
                           "Content-Length: %ld\r\n",
                           file_length);
                           file_length);
 
 
+#ifdef WEBNET_USING_KEEPALIVE
+	if(session->request->connection == WEBNET_CONN_KEEPALIVE)
+	{
+		webnet_session_printf(session,
+                          "Connection: %s\r\n",
+                          "Keep-Alive");
+	}
+	else
+	{
+		webnet_session_printf(session,
+                          "Connection: %s\r\n",
+                          "close");
+	}
+#else
+	webnet_session_printf(session,
+						"Connection: %s\r\n",
+                        "close");
+#endif
+
 #ifdef WEBNET_USING_GZIP
 #ifdef WEBNET_USING_GZIP
     if (request->support_gzip)
     if (request->support_gzip)
     {
     {