lejp-conf: add timeout-secs
authorAndy Green <andy@warmcat.com>
Mon, 2 Jan 2017 11:57:54 +0000 (19:57 +0800)
committerAndy Green <andy@warmcat.com>
Mon, 2 Jan 2017 11:57:54 +0000 (19:57 +0800)
README.lwsws.md
doc/html/md_README_8lwsws.html
lib/lejp-conf.c

index 165ed60..aeb8bc8 100644 (file)
@@ -90,6 +90,9 @@ if a keyword is found in the user agent
    }]
 ```
 
+ - `timeout-secs` lets you set the global timeout for various network-related
+ operations in lws, in seconds.  It defaults to 5.
 @section lwswsv Lwsws Vhosts
 
 One server can run many vhosts, where SSL is in use SNI is used to match
index 8fe3dce..0cfb403 100644 (file)
@@ -88,7 +88,10 @@ Other Global Options</h1>
 <ul>
 <li><code>reject-service-keywords</code> allows you to return an HTTP error code and message of your choice if a keyword is found in the user agent</li>
 </ul>
-<div class="fragment"><div class="line">&quot;reject-service-keywords&quot;: [{</div><div class="line">     &quot;scumbot&quot;: &quot;404 Not Found&quot;</div><div class="line">}]</div></div><!-- fragment --><h1><a class="anchor" id="lwswsv"></a>
+<div class="fragment"><div class="line">&quot;reject-service-keywords&quot;: [{</div><div class="line">     &quot;scumbot&quot;: &quot;404 Not Found&quot;</div><div class="line">}]</div></div><!-- fragment --><ul>
+<li><code>timeout-secs</code> lets you set the global timeout for various network-related operations in lws, in seconds. It defaults to 5.</li>
+</ul>
+<h1><a class="anchor" id="lwswsv"></a>
 Lwsws Vhosts</h1>
 <p>One server can run many vhosts, where SSL is in use SNI is used to match the connection to a vhost and its vhost-specific SSL keys during SSL negotiation.</p>
 <p>Listing multiple vhosts looks something like this </p><div class="fragment"><div class="line">{</div><div class="line"> &quot;vhosts&quot;: [ {</div><div class="line">     &quot;name&quot;: &quot;localhost&quot;,</div><div class="line">     &quot;port&quot;: &quot;443&quot;,</div><div class="line">     &quot;host-ssl-key&quot;:  &quot;/etc/pki/tls/private/libwebsockets.org.key&quot;,</div><div class="line">     &quot;host-ssl-cert&quot;: &quot;/etc/pki/tls/certs/libwebsockets.org.crt&quot;,</div><div class="line">     &quot;host-ssl-ca&quot;:   &quot;/etc/pki/tls/certs/libwebsockets.org.cer&quot;,</div><div class="line">     &quot;mounts&quot;: [{</div><div class="line">       &quot;mountpoint&quot;: &quot;/&quot;,</div><div class="line">       &quot;origin&quot;: &quot;file:///var/www/libwebsockets.org&quot;,</div><div class="line">       &quot;default&quot;: &quot;index.html&quot;</div><div class="line">       }, {</div><div class="line">        &quot;mountpoint&quot;: &quot;/testserver&quot;,</div><div class="line">        &quot;origin&quot;: &quot;file:///usr/local/share/libwebsockets-test-server&quot;,</div><div class="line">        &quot;default&quot;: &quot;test.html&quot;</div><div class="line">       }],</div><div class="line">     # which protocols are enabled for this vhost, and optional</div><div class="line">     # vhost-specific config options for the protocol</div><div class="line">     #</div><div class="line">     &quot;ws-protocols&quot;: [{</div><div class="line">       &quot;warmcat,timezoom&quot;: {</div><div class="line">         &quot;status&quot;: &quot;ok&quot;</div><div class="line">       }</div><div class="line">     }]</div><div class="line">    },</div><div class="line">    {</div><div class="line">    &quot;name&quot;: &quot;localhost&quot;,</div><div class="line">    &quot;port&quot;: &quot;7681&quot;,</div><div class="line">     &quot;host-ssl-key&quot;:  &quot;/etc/pki/tls/private/libwebsockets.org.key&quot;,</div><div class="line">     &quot;host-ssl-cert&quot;: &quot;/etc/pki/tls/certs/libwebsockets.org.crt&quot;,</div><div class="line">     &quot;host-ssl-ca&quot;:   &quot;/etc/pki/tls/certs/libwebsockets.org.cer&quot;,</div><div class="line">     &quot;mounts&quot;: [{</div><div class="line">       &quot;mountpoint&quot;: &quot;/&quot;,</div><div class="line">       &quot;origin&quot;: &quot;&gt;https://localhost&quot;</div><div class="line">     }]</div><div class="line">   },</div><div class="line">    {</div><div class="line">    &quot;name&quot;: &quot;localhost&quot;,</div><div class="line">    &quot;port&quot;: &quot;80&quot;,</div><div class="line">     &quot;mounts&quot;: [{</div><div class="line">       &quot;mountpoint&quot;: &quot;/&quot;,</div><div class="line">       &quot;origin&quot;: &quot;&gt;https://localhost&quot;</div><div class="line">     }]</div><div class="line">   }</div><div class="line"></div><div class="line">  ]</div><div class="line">}</div></div><!-- fragment --><p>That sets up three vhosts all called "localhost" on ports 443 and 7681 with SSL, and port 80 without SSL but with a forced redirect to <a href="https://localhost">https://localhost</a></p>
index 39f6ca4..b35b029 100644 (file)
@@ -37,6 +37,7 @@ static const char * const paths_global[] = {
        "global.server-string",
        "global.plugin-dir",
        "global.ws-pingpong-secs",
+       "global.timeout-secs",
        "global.reject-service-keywords[].*",
        "global.reject-service-keywords[]",
 };
@@ -49,6 +50,7 @@ enum lejp_global_paths {
        LEJPGP_SERVER_STRING,
        LEJPGP_PLUGIN_DIR,
        LWJPGP_PINGPONG_SECS,
+       LWJPGP_TIMEOUT_SECS,
        LWJPGP_REJECT_SERVICE_KEYWORDS_NAME,
        LWJPGP_REJECT_SERVICE_KEYWORDS
 };
@@ -269,6 +271,10 @@ lejp_globals_cb(struct lejp_ctx *ctx, char reason)
                a->info->ws_ping_pong_interval = atoi(ctx->buf);
                return 0;
 
+       case LWJPGP_TIMEOUT_SECS:
+               a->info->timeout_secs = atoi(ctx->buf);
+               return 0;
+
        default:
                return 0;
        }