<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Server on GenHTTP Webserver</title><link>https://genhttp.org/documentation/server/</link><description>Recent content in Server on GenHTTP Webserver</description><generator>Hugo</generator><language>en-us</language><atom:link href="https://genhttp.org/documentation/server/index.xml" rel="self" type="application/rss+xml"/><item><title>Adapters</title><link>https://genhttp.org/documentation/server/adapters/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://genhttp.org/documentation/server/adapters/</guid><description>&lt;p&gt;GenHTTP is both a web server and a web application development framework. Adapters&#10;allow to re-use the functionality of the GenHTTP modules in other server frameworks&#10;such as ASP.NET Core.&lt;/p&gt;&#10;&lt;h2 id="aspnet-core"&gt;ASP.NET Core&lt;a class="anchor" href="#aspnet-core" aria-label="Link to this section"&gt;&lt;svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"&gt;&lt;path d="M4 9h16M4 15h16M10 3 8 21M16 3l-2 18"/&gt;&lt;/svg&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="cards"&gt;&#13;&#10;&lt;a class="card card-icon" href="https://www.nuget.org/packages/GenHTTP.Adapters.AspNetCore/" rel="noopener"&gt;&lt;svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"&gt;&lt;path d="m16.5 9.4-9-5.19"/&gt;&lt;path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/&gt;&lt;path d="M3.29 7 12 12l8.71-5M12 22V12"/&gt;&lt;/svg&gt;&lt;span class="card-title"&gt;GenHTTP.Adapters.AspNetCore&lt;/span&gt; &lt;span class="card-text"&gt;Package on NuGet&lt;/span&gt;&lt;svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"&gt;&lt;path d="M7 17 17 7M8 7h9v9"/&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&#13;&#10;&lt;/div&gt;&#10;&#10;&lt;p&gt;This adapter allows to plug in any GenHTTP handler into an existing ASP.NET Core application.&#10;The following example will use the &lt;a href="../../content/handlers/listing/"&gt;listing&lt;/a&gt; module to render a graphical&#10;file listing when accessing http://localhost:5000/files/ in the browser.&lt;/p&gt;</description></item><item><title>Logging</title><link>https://genhttp.org/documentation/server/logging/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://genhttp.org/documentation/server/logging/</guid><description>&lt;p&gt;GenHTTP uses the &lt;a href="https://learn.microsoft.com/en-us/dotnet/core/extensions/logging/overview" rel="noopener"&gt;default logging mechanism&lt;/a&gt;&#10;of .NET Core and allows to create loggers via the &lt;code&gt;IServer&lt;/code&gt; interface. By default,&#10;the host will add a console logger.&lt;/p&gt;&#10;&lt;h2 id="logging-information"&gt;Logging Information&lt;a class="anchor" href="#logging-information" aria-label="Link to this section"&gt;&lt;svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"&gt;&lt;path d="M4 9h16M4 15h16M10 3 8 21M16 3l-2 18"/&gt;&lt;/svg&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;The following code shows to obtain a logger from the server instance in&#10;a custom &lt;code&gt;IHandler&lt;/code&gt; implementation. It is recommended to create the logger&#10;once in the preparation phase and store the reference somewhere. You can use&#10;this pattern anywhere where you have access to &lt;code&gt;IServer&lt;/code&gt; (e.g. via &lt;code&gt;request.Server&lt;/code&gt;).&lt;/p&gt;</description></item><item><title>Endpoints and Ports</title><link>https://genhttp.org/documentation/server/endpoints/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://genhttp.org/documentation/server/endpoints/</guid><description>&lt;p&gt;By default, the server will listen on port 8080 for incoming IPv4 or IPv6 connections on&#10;any interface. To simply change the port the server will listen on, you can use&#10;the &lt;code&gt;Port()&lt;/code&gt; directive of the host. Please note, that hosting a server on ports below 1024&#10;will require additional permissions on some operating systems.&lt;/p&gt;&#10;&lt;div class="code-block"&gt;&#10; &lt;div class="code-bar"&gt;&#10; &lt;span class="code-lang"&gt;C#&lt;/span&gt;&#10; &lt;button class="code-copy" type="button" data-copy aria-label="Copy the code" hidden&gt;&lt;svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"&gt;&lt;rect width="14" height="14" x="8" y="8" rx="2"/&gt;&lt;path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/&gt;&lt;/svg&gt;&lt;svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"&gt;&lt;path d="M20 6 9 17l-5-5"/&gt;&lt;/svg&gt;&lt;span&gt;Copy&lt;/span&gt;&lt;/button&gt;&#10; &lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-csharp" data-lang="csharp"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;host&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Host&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Create&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Handler&lt;/span&gt;&lt;span class="p"&gt;(...)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Port&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;80&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;To configure the server to listen on specific interfaces only, you can &lt;code&gt;Bind()&lt;/code&gt; those&#10;endpoints explicitly.&lt;/p&gt;</description></item><item><title>Security</title><link>https://genhttp.org/documentation/server/security/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://genhttp.org/documentation/server/security/</guid><description>&lt;p&gt;This page summarizes security considerations and configuration options&#10;when running GenHTTP applications.&lt;/p&gt;&#10;&lt;h2 id="general-considerations"&gt;General Considerations&lt;a class="anchor" href="#general-considerations" aria-label="Link to this section"&gt;&lt;svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"&gt;&lt;path d="M4 9h16M4 15h16M10 3 8 21M16 3l-2 18"/&gt;&lt;/svg&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;GenHTTP is designed to be used as an application server behind a reverse proxy, and therefore does not provide built-in DoS protection (such as IP connection limits or Slowloris prevention).&#10;However, compared to many other web service frameworks for C#, it is hardened against - and explicitly&#10;&lt;a href="https://www.http-probe.com/servers/genhttp.html" rel="noopener"&gt;tested for&lt;/a&gt; - typical attack vectors such as request smuggling, header injection, or malformed chunk attacks.&lt;/p&gt;</description></item></channel></rss>