<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/lib/libfetch, branch main</title>
<subtitle>FreeBSD source tree</subtitle>
<id>http://cgit.freebsd.org/src/atom?h=main</id>
<link rel='self' href='http://cgit.freebsd.org/src/atom?h=main'/>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/'/>
<updated>2026-07-30T16:36:27Z</updated>
<entry>
<title>libfetch: Further improve connection polling</title>
<updated>2026-07-30T16:36:27Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2026-07-30T16:36:27Z</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=351ed134887fe5b8da39d22fcb267c96ab009ca2'/>
<id>urn:sha1:351ed134887fe5b8da39d22fcb267c96ab009ca2</id>
<content type='text'>
* Reorganize the connection loop to make it a little more readable

* Start the timeout clock earlier

* Correctly calculate the poll timeout before calling poll()

* Don't leak the socket on failure

Fixes:		848f360c8f9a ("libfetch: Apply timeout to connection attempts")
Fixes:		b02e02958dad ("libfetch: Fix handling of connection failures")
MFC after:	3 days
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D58512
</content>
</entry>
<entry>
<title>libfetch: Fix handling of connection failures</title>
<updated>2026-07-27T23:03:16Z</updated>
<author>
<name>Mark Johnston</name>
<email>markj@FreeBSD.org</email>
</author>
<published>2026-07-27T18:58:34Z</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=b02e02958dad2d5ce3675cbc18b9a94635d09e66'/>
<id>urn:sha1:b02e02958dad2d5ce3675cbc18b9a94635d09e66</id>
<content type='text'>
After commit 848f360c8f9a, if one tries to connect to a closed port,
fetch reports "Operation now in progress", which is rather confusing.
Return a more useful error message, restoring the old behaviour.

Fixes:		848f360c8f9a ("libfetch: Apply timeout to connection attempts")
Reviewed by:	des
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D58481
</content>
</entry>
<entry>
<title>libfetch: Reduce copying</title>
<updated>2026-07-13T06:43:56Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2026-07-13T06:43:56Z</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=60382b4a04fa39e9bf65b964b1b7b4bed6eaa56a'/>
<id>urn:sha1:60382b4a04fa39e9bf65b964b1b7b4bed6eaa56a</id>
<content type='text'>
Reduce the amount of copying we do when performing buffered reads.

MFC after:	1 week
Reviewed by:	op
Differential Revision:	https://reviews.freebsd.org/D58113
</content>
</entry>
<entry>
<title>libfetch: Make fetch_ref an inline</title>
<updated>2026-07-13T06:43:51Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2026-07-13T06:43:51Z</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=d4e0e1fbc237f0765b9f32b291c087348031c921'/>
<id>urn:sha1:d4e0e1fbc237f0765b9f32b291c087348031c921</id>
<content type='text'>
Make fetch_ref() an inline and provide a fetch_deref().

MFC after:	1 week
Reviewed by:	op
Differential Revision:	https://reviews.freebsd.org/D57944
</content>
</entry>
<entry>
<title>libfetch: Document fetchTimeout</title>
<updated>2026-07-13T06:43:42Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2026-07-13T06:43:42Z</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=27b411734c75a7a5abe641d7fbb99dfc622e9aba'/>
<id>urn:sha1:27b411734c75a7a5abe641d7fbb99dfc622e9aba</id>
<content type='text'>
Document the global fetchTimeout variable, now that it works reliably.

MFC after:	1 week
Reviewed by:	op
Differential Revision:	https://reviews.freebsd.org/D57910
</content>
</entry>
<entry>
<title>libfetch: Apply timeout to connection attempts</title>
<updated>2026-07-13T06:43:37Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2026-07-13T06:43:37Z</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=848f360c8f9ae8d1d97c61f5d63fc624926d5dcd'/>
<id>urn:sha1:848f360c8f9ae8d1d97c61f5d63fc624926d5dcd</id>
<content type='text'>
Mark the socket non-blocking before connecting and poll for completion,
applying fetchTimeout if set.

MFC after:	1 week
Reviewed by:	op
Differential Revision:	https://reviews.freebsd.org/D57909
</content>
</entry>
<entry>
<title>libfetch: Add read buffering</title>
<updated>2026-07-13T06:43:33Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2026-07-13T06:43:33Z</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=a1978277379cf65f1339ab062f335c6f1fa6239f'/>
<id>urn:sha1:a1978277379cf65f1339ab062f335c6f1fa6239f</id>
<content type='text'>
Previously, we would read FTP control connection messages and HTTP
reponse headers one character at a time.  Now, we read as much as will
fit in our buffer and look for a newline.  If there is data left over,
it will be reused by the next fetch_getln() call.  This also requires
the addition of a fetch_bufread() which takes the buffer into account,
otherwise the start of the HTTP response body will be stuck in the
buffer after we read the last line of the header.

This should noticeably improve HTTP performance, especially for small
transfers.

MFC after:	1 week
Reviewed by:	op
Differential Revision:	https://reviews.freebsd.org/D57907
</content>
</entry>
<entry>
<title>libfetch: Overhaul socket read / write</title>
<updated>2026-07-13T06:43:28Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2026-07-13T06:43:28Z</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=32c341bd1c8b1154128f62fafa6988ed29db564a'/>
<id>urn:sha1:32c341bd1c8b1154128f62fafa6988ed29db564a</id>
<content type='text'>
* Make fetch_ssl_read() and fetch_ssl_write() behave more like read(2)
  and write(2), and drop fetch_socket_read() in favor of read(2).

* Don't request POLLERR, it's implied.

* Don't needlessly set errno, it's relatively costly.

* Always check for EAGAIN from writev(2), otherwise we will abort on a
  short write instead of proceeding to poll(2).

* Always check for EAGAIN from poll(2) even though it can't happen on
  FreeBSD; POSIX says it can, and it might in the future.

* Rewrite fetch_read() and fetch_writev() to be more similar to each
  other.  The main difference is that a partial read is treated as
  success while a partial write is treated as failure.

PR:		296316
MFC after:	1 week
Reviewed by:	op
Differential Revision:	https://reviews.freebsd.org/D57906
</content>
</entry>
<entry>
<title>Revert "libfetch: Overhaul socket read / write"</title>
<updated>2026-06-29T15:53:56Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2026-06-29T15:53:56Z</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=da4d1ced75f3be17f8b089a364f642a04eb0d466'/>
<id>urn:sha1:da4d1ced75f3be17f8b089a364f642a04eb0d466</id>
<content type='text'>
This reverts commit 298f37a71ae6d9f2cb0c2abd4ff2887e81e0942c.
</content>
</entry>
<entry>
<title>Revert "libfetch: Add read buffering"</title>
<updated>2026-06-29T15:53:55Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2026-06-29T15:53:55Z</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=fde60e3a4e922e7931c39f10105e3fbe33f54534'/>
<id>urn:sha1:fde60e3a4e922e7931c39f10105e3fbe33f54534</id>
<content type='text'>
This reverts commit afb60498e0c9836a6e3a7efda8a51710e208a608.
</content>
</entry>
</feed>
