<feed xmlns='http://www.w3.org/2005/Atom'>
<title>pakakeh.go/lib/http, branch dev</title>
<subtitle>Collections of packages and tools for working with Go programming language.</subtitle>
<id>http://git.kilabit.info/pakakeh.go/atom?h=dev</id>
<link rel='self' href='http://git.kilabit.info/pakakeh.go/atom?h=dev'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/'/>
<updated>2026-04-04T20:52:47Z</updated>
<entry>
<title>all: apply go fix</title>
<updated>2026-04-04T20:52:47Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2026-04-04T20:50:32Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=778fd16011ec1d39c41b62372dc65f045183266e'/>
<id>urn:sha1:778fd16011ec1d39c41b62372dc65f045183266e</id>
<content type='text'>
</content>
</entry>
<entry>
<title>lib/http: fix possible data race in SSE connection</title>
<updated>2026-02-15T05:45:13Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2026-02-15T05:44:24Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=1844b9e48d0f5f7f3e9c8de026181d04d74c92ab'/>
<id>urn:sha1:1844b9e48d0f5f7f3e9c8de026181d04d74c92ab</id>
<content type='text'>
When server's handler call Write or WriteRaw, there is possibility that
the worker for keeping the connection alive also call Write at the same
time, which cause the data race.
</content>
</entry>
<entry>
<title>lib/http: realign the fields in struct Server</title>
<updated>2026-02-13T05:43:14Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2026-02-13T05:43:14Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=ccc9926635c1702337ac6fd1038bd7b903afa7f9'/>
<id>urn:sha1:ccc9926635c1702337ac6fd1038bd7b903afa7f9</id>
<content type='text'>
Previous struct size is 384 pointer bytes, now realign to 336 bytes
(-48 bytes).
</content>
</entry>
<entry>
<title>lib/http: implement server auto shutdown when idle</title>
<updated>2026-02-11T14:43:11Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2026-02-11T14:43:11Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=5b41090e6c523a1e66047329e51c2b0db280a581'/>
<id>urn:sha1:5b41090e6c523a1e66047329e51c2b0db280a581</id>
<content type='text'>
In the `ServerOptions`, we add option `ShutdownIdleDuration` when set to
non-zero value it will start a timer.
When the timer expired, the server will stop accepting new connection and
then shutting down.

This allow de-activating HTTP server when no connections received after
specific duration to reduce the system resources.
</content>
</entry>
<entry>
<title>lib/http: add BasePath to the ServerOptions</title>
<updated>2026-02-11T13:53:23Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2026-02-11T13:52:42Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=37c0e3f259204842c1ac82a04effb6c12e76078d'/>
<id>urn:sha1:37c0e3f259204842c1ac82a04effb6c12e76078d</id>
<content type='text'>
The BasePath allow server to serve HTTP from custom prefix, other than
"/".

Each request that server received will remove the BasePath first
from the [http.Request.URL.Path] before passing to the handler.
Each redirect that server sent will add the BasePath as the prefix
to redirect URL.

Any trailing slash in the BasePath will be removed.
</content>
</entry>
<entry>
<title>lib/http: change HandleFS redirect status code to 301 Moved Permanently</title>
<updated>2026-02-05T12:29:05Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2026-02-05T12:29:05Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=fad13afac8b51e61ad5465c88021895a95403a15'/>
<id>urn:sha1:fad13afac8b51e61ad5465c88021895a95403a15</id>
<content type='text'>
According to MDN [Redirections in HTTP], the HTTP status 302 Found use
case is

	The Web page is temporarily unavailable for unforeseen reasons.

This probably to re-route the page until the original page is fixed.
While HTTP status 301 is for

	Reorganization of a website.

Since the redirection in HandleFS only happen when user access directory
without slash, we should make it permanent.

[Redirections in HTTP]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Redirections
</content>
</entry>
<entry>
<title>lib/http: handle file system with canonical directory end with slash "/"</title>
<updated>2026-02-05T12:26:29Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2026-02-05T12:26:29Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=3734420eec485bca8c18243741e1ad2a683515b7'/>
<id>urn:sha1:3734420eec485bca8c18243741e1ad2a683515b7</id>
<content type='text'>
Previously, if request to directory does not end with "/", the HTTP
server will return the index.html of that directory.
This cause relative link inside the index.html broken when visited from
browser.

This changes make the request to directory always end with "/" by
redirecting the request with status 303 Found.
</content>
</entry>
<entry>
<title>lib/http: add field Listener to ServerOptions</title>
<updated>2026-02-02T09:28:11Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2026-02-02T09:22:48Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=1e3bb9be8444082dc1ada7f76a727b9a9f764d47'/>
<id>urn:sha1:1e3bb9be8444082dc1ada7f76a727b9a9f764d47</id>
<content type='text'>
The field Listener allow user to pass [net.Listener] for accepting new
connection using [http.Serve] or [http.ServeTLS].
</content>
</entry>
<entry>
<title>all: convert license and copyright to use SPDX identifiers</title>
<updated>2026-01-15T10:26:33Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2026-01-15T10:14:54Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=7db8c302e1396eda40cd6a1e57f58ed791448556'/>
<id>urn:sha1:7db8c302e1396eda40cd6a1e57f58ed791448556</id>
<content type='text'>
With help of spdxconv tool [1], we able to bulk update all files license
and copyright format to comply with SPDX formats.

[1] https://kilabit.info/project/spdxconv/
</content>
</entry>
<entry>
<title>lib/http: add second return value, statusCode, to FSHandler</title>
<updated>2026-01-06T16:05:47Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2026-01-06T16:00:07Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=e91954b5a65847970903e0d8294e54d918c8bc0b'/>
<id>urn:sha1:e91954b5a65847970903e0d8294e54d918c8bc0b</id>
<content type='text'>
Non-zero status code indicates that the function already response
to the request, and the server will return immediately.

Zero status code indicates that the function did not process the request,
it is up to server to process the returned node `out`.
</content>
</entry>
</feed>
