<feed xmlns='http://www.w3.org/2005/Atom'>
<title>xavi/slcl/http.c, branch imagemagick</title>
<subtitle>Small and lightweight cloud storage written in C99 and POSIX.1-2008.
</subtitle>
<id>https://gitea.privatedns.org/xavi/slcl/atom?h=imagemagick</id>
<link rel='self' href='https://gitea.privatedns.org/xavi/slcl/atom?h=imagemagick'/>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/'/>
<updated>2023-03-24T01:49:11+00:00</updated>
<entry>
<title>Define _POSIX_C_SOURCE</title>
<updated>2023-03-24T01:49:11+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2023-03-24T01:47:11+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/commit/?id=b3ef22ac2ae126951c5b74003c7b17189c0ecbbb'/>
<id>urn:sha1:b3ef22ac2ae126951c5b74003c7b17189c0ecbbb</id>
<content type='text'>
This allows using the default compiler defined by make(1) (i.e.,
c99(1)), thus improving POSIX compatibility.
</content>
</entry>
<entry>
<title>http.c: Add missing #include</title>
<updated>2023-03-24T01:46:55+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2023-03-24T01:46:55+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/commit/?id=4501c66ebde5c4fc86eda193fe204d5b35e85652'/>
<id>urn:sha1:4501c66ebde5c4fc86eda193fe204d5b35e85652</id>
<content type='text'>
As required by strncasecmp(3).
</content>
</entry>
<entry>
<title>Send response on quota exceeded</title>
<updated>2023-03-20T09:57:20+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2023-03-20T02:32:00+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/commit/?id=d9bb874591c63f2efbfc1c4c953934251c700e9f'/>
<id>urn:sha1:d9bb874591c63f2efbfc1c4c953934251c700e9f</id>
<content type='text'>
So far, slcl would just close the connection with a client when the
Content-Length of an incoming request exceeded the user quota, without
any meaningful information given back to the user.

Now, slcl responds with a HTML file with meaningful information about
the error.

Limitations:

- While this commits has been successfully tested on ungoogled-chromium,
LibreWolf (and I assume Firefox and any other derivates too) does not
seem to receive the response from the server.
    - However, this issue only occurred during local testing, but not
on remote instances.
</content>
</entry>
<entry>
<title>http.c: Minor formatting change</title>
<updated>2023-03-08T17:52:36+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2023-03-08T17:52:36+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/commit/?id=e0fc222f1d3dc1a6672bdbbd7009b08cfd49d776'/>
<id>urn:sha1:e0fc222f1d3dc1a6672bdbbd7009b08cfd49d776</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Remove(3) f-&gt;tmpname from ctx_free</title>
<updated>2023-03-08T17:17:32+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2023-03-08T17:02:36+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/commit/?id=e37a0248e865db2d69c89d5c7bd8651dae255cab'/>
<id>urn:sha1:e37a0248e865db2d69c89d5c7bd8651dae255cab</id>
<content type='text'>
Until now, f-&gt;tmpname was removed by move_file when the move
operation succeeded. However, since a HTTP operation can fail before
move_file is called, the temporary file must also be removed.
</content>
</entry>
<entry>
<title>Implement user quota</title>
<updated>2023-03-06T04:51:49+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2023-03-06T04:09:56+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/commit/?id=ff8da797a143cb1dfbeb4ce2d2c3e4a1d0c2e56a'/>
<id>urn:sha1:ff8da797a143cb1dfbeb4ce2d2c3e4a1d0c2e56a</id>
<content type='text'>
This feature allows admins to set a specific quota for each user, in
MiB. This feature is particularly useful for shared instances, where
unlimited user storage might be unfeasible or even dangerous for the
server.

Also, a nice HTML5 &lt;progress&gt; element has been added to the site that
shows how much of the quota has been consumed.

If no quota is set, slcl falls back to the default behaviour i.e.,
assume unlimited storage.

Limitations:

- While HTTP does specify a Content-Length, which determines the length
of the whole request, it does not specify how many files are involved
or their individual sizes.
- Because of this, if multiple files are uploaded simultaneously, the
whole request would be dropped if user quota is exceeded, even if not
all files exceeded it.
- Also, Content-Length adds the length of some HTTP boilerplate
(e.g.: boundaries), but slcl must rely on this before accepting the
whole request. In other words, this means some requests might be
rejected by slcl because of the extra bytes caused by such boilerplate.
- When the quota is exceeded, slcl must close the connection so that
the rest of the transfer is cancelled. Unfortunately, this means no
HTML can be sent back to the customer to inform about the situation.
</content>
</entry>
<entry>
<title>http.c: Compare headers as case-insensitive</title>
<updated>2023-03-04T03:04:09+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2023-03-04T03:04:09+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/commit/?id=8319dfe58b99f44f52abd0e4db0f6a0200207a1a'/>
<id>urn:sha1:8319dfe58b99f44f52abd0e4db0f6a0200207a1a</id>
<content type='text'>
Web browsers such as lynx send "Content-length" instead of
"Content-Length" (as done by LibreWolf and Chromium).
</content>
</entry>
<entry>
<title>http.c: Use persistent cookies</title>
<updated>2023-03-04T03:02:14+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2023-03-04T03:02:14+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/commit/?id=fff6ed4e0a656a89c787a6461cd8a29eec3d0a71'/>
<id>urn:sha1:fff6ed4e0a656a89c787a6461cd8a29eec3d0a71</id>
<content type='text'>
Cookies without "Expires" are considered non-persistent and thus can be
removed by the web browser. Instead, slcl now sets persistent cookies
that last for 1 year.
</content>
</entry>
<entry>
<title>http.c: Improve error detection for strotull(3)</title>
<updated>2023-03-04T02:03:22+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2023-03-04T01:34:55+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/commit/?id=c033b3006cb90e7396403d7ac3d2fb6f08a91028'/>
<id>urn:sha1:c033b3006cb90e7396403d7ac3d2fb6f08a91028</id>
<content type='text'>
set_length relies on user input to determine Content-Length, so it
should be considered unreliable.
</content>
</entry>
<entry>
<title>Fix memory leak on failed realloc(3)</title>
<updated>2023-03-04T02:03:15+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2023-03-04T01:06:19+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/commit/?id=62bdf9f72f6a65b76bbb97ffa467e16217646cbc'/>
<id>urn:sha1:62bdf9f72f6a65b76bbb97ffa467e16217646cbc</id>
<content type='text'>
According to C99 §7.20.3.4:

If memory for the new object cannot be allocated, the old object is not
deallocated and its value is unchanged.

Therefore, a temporary pointer must be used to ensure the original
object can still be deallocated should realloc(3) return a null pointer.
</content>
</entry>
</feed>
