<feed xmlns='http://www.w3.org/2005/Atom'>
<title>pakakeh.go/lib/http/server_test.go, 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-02-11T14:43:11Z</updated>
<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: 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 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>
<entry>
<title>lib/http: always refresh a directory on GET request</title>
<updated>2025-01-22T14:34:16Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2025-01-22T13:49:40Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=18d3a3aad4b6ad3358159d48cd158c2cb2c71e5a'/>
<id>urn:sha1:18d3a3aad4b6ad3358159d48cd158c2cb2c71e5a</id>
<content type='text'>
On server with TryDirect is true, any GET request to a directory should
always rescan the content and the generate the new index.html.

While at it, return the generated time in UTC instead of local time.

</content>
</entry>
<entry>
<title>lib/http: add Server method to register handler by function</title>
<updated>2024-09-30T16:04:56Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2024-09-26T17:25:09Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=69966b7be999223dc7a1ab0c5a3339010e11433c'/>
<id>urn:sha1:69966b7be999223dc7a1ab0c5a3339010e11433c</id>
<content type='text'>
The RegisterHandleFunc register a pattern with a handler, similar to
[http.ServeMux.HandleFunc].
The pattern follow the Go 1.22 format:

	[METHOD] PATH

The METHOD is optional, default to GET.
The PATH must not contains the domain name and space.
Unlike standard library, variable in PATH is read using ":var" not
"{var}".
This endpoint will accept any content type and return the body as is;
it is up to the handler to read and set the content type and the response
headers.

If the METHOD and/or PATH is already registered it will panic.
</content>
</entry>
<entry>
<title>lib/http: remove writing StatusNoContent on ResponseTypeNode</title>
<updated>2024-09-30T16:04:56Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2024-09-26T17:19:44Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=a0f3864d5dc77e8fb496fc88fd48a6a7869ef000'/>
<id>urn:sha1:a0f3864d5dc77e8fb496fc88fd48a6a7869ef000</id>
<content type='text'>
To make consistent with RequestTypeNone, the
ResponseTypeNone should not write any response header or
HTTP status code.
It will be handled manually by [Endpoint.Call].
</content>
</entry>
<entry>
<title>lib/http: refactoring Client methods to return struct ClientResponse</title>
<updated>2024-03-14T17:59:35Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2024-03-14T17:59:35Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=b9e12300d9050143fcfaa2193ad91842f035661f'/>
<id>urn:sha1:b9e12300d9050143fcfaa2193ad91842f035661f</id>
<content type='text'>
Instead of returning three variables, [http.Response], []byte, and error,
we combine the [http.Response] and []byte into single struct:
ClientResponse.
</content>
</entry>
<entry>
<title>lib/http: refactor Client methods to use struct ClientRequest</title>
<updated>2024-03-14T16:51:34Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2024-03-11T18:06:15Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=c7de9d3df399c7ee1c2db2c4c253869951487ab5'/>
<id>urn:sha1:c7de9d3df399c7ee1c2db2c4c253869951487ab5</id>
<content type='text'>
</content>
</entry>
<entry>
<title>lib/http: add test for Server handleDelete</title>
<updated>2024-03-14T16:51:34Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2024-03-08T22:04:37Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=3ecf5e7b4844a565fce590ebb507f6e7cc98b798'/>
<id>urn:sha1:3ecf5e7b4844a565fce590ebb507f6e7cc98b798</id>
<content type='text'>
</content>
</entry>
<entry>
<title>lib/http: refactoring NewServer and NewClient</title>
<updated>2024-03-08T18:10:24Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2024-03-07T19:52:16Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=29343294a596fd74f6f9cb917c8aac74ccb78094'/>
<id>urn:sha1:29343294a596fd74f6f9cb917c8aac74ccb78094</id>
<content type='text'>
The NewServer and NewClient now accept non-pointer options, so the
caller unable to modify the options once the server or client has
been created.
</content>
</entry>
</feed>
