<feed xmlns='http://www.w3.org/2005/Atom'>
<title>xavi/libweb/http.c, branch v0.3.0</title>
<subtitle>Small and lightweight web framework written in C99 and POSIX.1-2008.
</subtitle>
<id>https://gitea.privatedns.org/xavi/libweb/atom?h=v0.3.0</id>
<link rel='self' href='https://gitea.privatedns.org/xavi/libweb/atom?h=v0.3.0'/>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/libweb/'/>
<updated>2024-02-19T22:00:56+00:00</updated>
<entry>
<title>Limit maximum multipart/form-data pairs and files</title>
<updated>2024-02-19T22:00:56+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2024-02-19T22:00:56+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/libweb/commit/?id=afe0681c0b26bb64bad55d7e86770f346cfa043e'/>
<id>urn:sha1:afe0681c0b26bb64bad55d7e86770f346cfa043e</id>
<content type='text'>
A malicious user could inject an infinite number of empty files or
key/value pairs into a request in order to exhaust the device's
resources.
</content>
</entry>
<entry>
<title>http.c: Solve performance issues on POST uploads</title>
<updated>2024-01-20T00:19:57+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2024-01-20T00:05:05+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/libweb/commit/?id=43be8d95f681c8240847b4f69a524a0ab20d5c83'/>
<id>urn:sha1:43be8d95f681c8240847b4f69a524a0ab20d5c83</id>
<content type='text'>
Profiling showed that reading multipart/form POST uploads byte-by-byte
was too slow and typically led to maximum CPU usage. Therefore, the
older approach (as done up to commit 7efc2b3a) was more efficient, even
if the resulting code was a bit uglier.
</content>
</entry>
<entry>
<title>http.c: Unify read operations</title>
<updated>2023-11-24T00:36:38+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2023-11-23T23:52:50+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/libweb/commit/?id=b0accd099fa8c5110d4c3c68830ad6fd810ca3ec'/>
<id>urn:sha1:b0accd099fa8c5110d4c3c68830ad6fd810ca3ec</id>
<content type='text'>
So far, libweb would perform different read operations depending on its
state:

- For HTTP headers or request bodies, one byte at a time was read.
- For multipart/form-data, up to BUFSIZ bytes at a time were read.

However, this caused a significant extra number of syscalls for no
reason and would increase code complexity, specially when parsing
multiform/form-data boundaries.

Now, http_read always reads up to BUFSIZ bytes at a time and process
them on a loop. Apart from reducing code complexity, this should
increase performance due to the (much) lower number of syscalls
required.
</content>
</entry>
<entry>
<title>http.c. Limit multipart/form-data to POST</title>
<updated>2023-11-20T15:34:24+00:00</updated>
<author>
<name>Xavier Del Campo</name>
<email>xavier.delcampo@midokura.com</email>
</author>
<published>2023-11-17T13:56:07+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/libweb/commit/?id=1750bbd7ec7277375c0ccd815cd2aed541e7e862'/>
<id>urn:sha1:1750bbd7ec7277375c0ccd815cd2aed541e7e862</id>
<content type='text'>
</content>
</entry>
<entry>
<title>http: Add support for PUT</title>
<updated>2023-11-20T15:34:24+00:00</updated>
<author>
<name>Xavier Del Campo</name>
<email>xavier.delcampo@midokura.com</email>
</author>
<published>2023-11-17T11:53:59+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/libweb/commit/?id=1755ee663cd67cd8d9adf9f06dd82b0477adab76'/>
<id>urn:sha1:1755ee663cd67cd8d9adf9f06dd82b0477adab76</id>
<content type='text'>
Notes:

- Since curl would use the "Expect: 100-continue" header field for PUT
operations, this was a good operation to fix the existing issues in its
implementation.

Breaking changes:

- expect_continue is no longer exclusive to struct http_post. Now, it
has been moved into struct http_payload and it is up to users to check
it.
</content>
</entry>
<entry>
<title>Send HTTP headers to payload callback</title>
<updated>2023-11-18T00:03:12+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2023-11-17T23:56:04+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/libweb/commit/?id=65031ca3502e0c27780be847fd97c112546741a9'/>
<id>urn:sha1:65031ca3502e0c27780be847fd97c112546741a9</id>
<content type='text'>
Even if libweb already parses some common headers, such as
Content-Length, some users might find it interesting to inspect which
headers were received from a request.

Since HTTP/1.1 does not define a limit on the number of maximum headers
a client can send, for security reasons a maximum value must be provided
by the user. Any extra headers shall be then discarded by libweb.

An example application showing this new feature is also provided.
</content>
</entry>
<entry>
<title>http.c: Fix more issues with partial boundaries</title>
<updated>2023-11-12T22:31:57+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2023-11-12T22:31:57+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/libweb/commit/?id=b71a6174e12b4709acaf8bc151938ba12d2a54f6'/>
<id>urn:sha1:b71a6174e12b4709acaf8bc151938ba12d2a54f6</id>
<content type='text'>
- http_memmem must not check strlen(a) &gt; n because, in case of a partial
boundary, it would wrongfully return NULL.
- If one or more characters from a partial boundary are found at the end
of a buffer, but the next buffer does not start with the rest of the
boundary, the accumulated boundary must be reset, and then look for a
new boundary.
</content>
</entry>
<entry>
<title>http.c: Fix several issues with partial boundaries</title>
<updated>2023-11-12T05:52:48+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2023-11-12T05:16:26+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/libweb/commit/?id=7d02b225fe11fb0c7233cd2ea576485ee920f203'/>
<id>urn:sha1:7d02b225fe11fb0c7233cd2ea576485ee920f203</id>
<content type='text'>
- Writing to m-&gt;boundary[len] did not make any sense, as len is not
meant to change between calls to read_mf_boundary_byte.
- For the same reason, memset(3)ing "len + 1" did not make any sense.
- When a partial boundary is found, http_memmem must still return st.
- Calling reset_boundary with prev == 0 did not make sense, since that
case typically means a partial boundary was found on a previous
iteration, so m-&gt;blen must not be reset.
</content>
</entry>
<entry>
<title>http: Make http_decode_url return int</title>
<updated>2023-11-12T00:29:54+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2023-11-11T23:14:05+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/libweb/commit/?id=9ac68fd76c43523ea3aa3bcc4f9fef0ac2cee830'/>
<id>urn:sha1:9ac68fd76c43523ea3aa3bcc4f9fef0ac2cee830</id>
<content type='text'>
So far, it was not possible callers to distinguish between decoding
errors, as caused by ill-formed input, from fatal errors.
</content>
</entry>
<entry>
<title>http.c: Avoid use of dynstr_append_or_ret_nonzero</title>
<updated>2023-11-12T00:29:54+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2023-11-11T23:50:06+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/libweb/commit/?id=957ac188e57cbb16db183fbd0fc87b09fea8e20c'/>
<id>urn:sha1:957ac188e57cbb16db183fbd0fc87b09fea8e20c</id>
<content type='text'>
This macro would return a positive integer on failure. However,
functions called by http_update should only return a positive integer
for user input-related errors, not fatal errors such as those related to
failed memory allocations.
</content>
</entry>
</feed>
