]> prime8.dev >> repos - ttyd.git/commitdiff
Do not try to reuse for lws_serve_http_file, fixes #43
authordohnuts <dohnuts@users.noreply.github.com>
Mon, 24 Apr 2017 21:28:54 +0000 (17:28 -0400)
committerShuanglei Tao <tsl0922@gmail.com>
Tue, 25 Apr 2017 12:35:41 +0000 (20:35 +0800)
Following documentation it s important to not try to reuse when lws_serve_http_file
return 0 nor to try to reuse the socket.

This fix the issue on openbsd 6.0 ( my current test is with upgraded libwebsocket 2.0.3 instead of 2.0.2 but it shouldnt matter

src/http.c

index 7c6dc943318b16d3e8a178cccd935de753b9dcba..d569ce978f9c06ab0318aafc508f0a94907b5ce7 100644 (file)
@@ -122,8 +122,9 @@ callback_http(struct lws *wsi, enum lws_callback_reasons reason, void *user, voi
 
                 if (lws_write_http(wsi, index_html, index_html_len) < 0)
                     return 1;
+                goto try_to_reuse;
             }
-            goto try_to_reuse;
+            break;
         case LWS_CALLBACK_OPENSSL_PERFORM_CLIENT_CERT_VERIFICATION:
             if (!len || (SSL_get_verify_result((SSL *) in) != X509_V_OK)) {
                 int err = X509_STORE_CTX_get_error((X509_STORE_CTX *) user);