<feed xmlns='http://www.w3.org/2005/Atom'>
<title>pakakeh.go/lib/http/testdata, 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-05T12:29:05Z</updated>
<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>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: 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: refactoring "multipart/form-data" parameters in ClientRequest</title>
<updated>2024-04-24T07:57:02Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2024-04-23T12:15:54Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=072a5866613aab933d03bef7df5a2dcb3a0855e4'/>
<id>urn:sha1:072a5866613aab933d03bef7df5a2dcb3a0855e4</id>
<content type='text'>
Previously, ClientRequest with type RequestTypeMultipartForm pass the
type "map[string][]byte" in Params.
This type hold the file upload, where key is the file name and []byte is
content of file.
Unfortunately, this model does not correct because a
"multipart/form-data" can contains different field name and file name,
for example

  --boundary
  Content-Disposition: form-data; name="field0"; filename="file0"
  Content-Type: application/octet-stream

  &lt;Content of file0&gt;

This changes fix this by changing the parameter type for
RequestTypeMultipartForm to [*multipart.Form], which affect several
functions including [Client.PutFormData] and [GenerateFormData].

We also add new function [CreateMultipartFileHeader] to help creating
[multipart.FileHeader] from raw bytes, that can be assigned to
[*multipart.Form].
</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 Range request, limit content served by server</title>
<updated>2024-01-23T17:07:18Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2024-01-18T20:39:50Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=eb2b4dbdeceb663b1ce29bc08cd5446ecf4c1f07'/>
<id>urn:sha1:eb2b4dbdeceb663b1ce29bc08cd5446ecf4c1f07</id>
<content type='text'>
When server receive,

	GET /big
	Range: bytes=0-

and the requested resources is quite larger, where writing all content of
file result in i/o timeout, it is best practice [1][2] if the server
write only partial content and let the client continue with the
subsequent Range request.

In the above case, the server should response with,

	HTTP/1.1 206 Partial content
	Content-Range: bytes 0-&lt;limit&gt;/&lt;size&gt;
	Content-Length: &lt;limit&gt;

Where limit is maximum packet that is reasonable [3] for most of the
client.
In this server we choose 8MB as limit.

[1]: https://stackoverflow.com/questions/63614008/how-best-to-respond-to-an-open-http-range-request
[2]: https://bugzilla.mozilla.org/show_bug.cgi?id=570755
[3]: https://docs.aws.amazon.com/whitepapers/latest/s3-optimizing-performance-best-practices/use-byte-range-fetches.html
</content>
</entry>
<entry>
<title>lib/http: add function to parse multipart Range response for Client</title>
<updated>2023-03-12T04:37:17Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2023-03-11T13:16:59Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=7d4c26cef490689eb5817c17e102d1e7128c682e'/>
<id>urn:sha1:7d4c26cef490689eb5817c17e102d1e7128c682e</id>
<content type='text'>
The ParseMultipartRange parse the multipart/byteranges body or response
from HTTP Range request.
Each Content-Range position and body part in the multipart will be stored
under RangePosition.
</content>
</entry>
<entry>
<title>lib/http: add integration test for request HEAD for Range</title>
<updated>2023-03-12T04:35:44Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2023-03-11T09:19:56Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=8e2fa2b18662da4e42bc2be5f20103dd5e2cb8f8'/>
<id>urn:sha1:8e2fa2b18662da4e42bc2be5f20103dd5e2cb8f8</id>
<content type='text'>
The test check the response header, whether the Accept-Ranges printed
or not.
</content>
</entry>
</feed>
