Certain features, such as HTTP/2, HTTPS, or compression might not be needed. When Kvarn is deployed to an IOT device controlled from within the network, these features aren’t needed. Disabling them cuts down on compilation time, memory requirements, and space requirements.
To view the dependencies used by each feature, see the Cargo.toml file.
These can be enabled in your Cargo.toml
:
[dependencies]
kvarn = { version = "0.4", default-features = false, features = ["https", "http2", "all-compression"] }
See the official Cargo guide on the matter.
Which Cargo features are required for certain items are also shown in the docs
(e.g. the Host::new
function).
https
: Enables HTTPS, the secure HTTP protocol. This is strongly recommended if you’re doing anything that’s not resource constrained and local.http2
: Enables HTTP/2. This is strongly recommended as it’s considerably faster and less resource intensive than HTTP/1.1, which is always supported. This also reduces latency due to implementation details.br
: Brotli compressiongzip
: Gzip compressiongraceful-shutdown
: Enables graceful shutdown and handover. This means you can upgrade the Kvarn server without ANY downtime - using UNIX socket magic we bind the new server on the same sockets, then tell the old instance to shut down. All pending and current requests are waited for.auto-hostname
: Populates the host name and alternative names automatically. This uses the info stored in the certificate.nonce
: enables usage of nonce on inline<script>
and<style>
elements.
There are additionally several feature sets:
full
: enables all the features above.all-http
: enables all HTTP standards and versions available -https
&http2
all-compression
: enables all compression features -br
&gzip