Skip to content

Commit

Permalink
lejp-conf: add timeout-secs
Browse files Browse the repository at this point in the history
  • Loading branch information
lws-team committed Jan 2, 2017
1 parent 714f66f commit 58a26eb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.lwsws.md
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion doc/html/md_README_8lwsws.html
Expand Up @@ -88,7 +88,10 @@ <h1><a class="anchor" id="lwswsc"></a>
<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>
Expand Down
6 changes: 6 additions & 0 deletions lib/lejp-conf.c
Expand Up @@ -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[]",
};
Expand All @@ -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
};
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 58a26eb

Please sign in to comment.