freebsd-dev/contrib/serf
John Baldwin cb7cc72c54 serf: Fix the default return value of the BIO control method.
OpenSSL BIO classes provide an abstraction for dealing with I/O.
OpenSSL provides BIO classes for commonly used I/O primitives backed
by file descriptors, sockets, etc. as well as permitting consumers
of OpenSSL to define custom BIO classes.

One of the methods BIO classes implement is a control method invoked
by BIO_ctrl() for various ancilliary tasks somewhat analgous to
fcntl() and ioctl() on file descriptors.  According to the BIO_ctrl(3)
manual page, control methods should return 0 for unknown control
requests.

KTLS support in OpenSSL adds new control requests.  Two of those new
requests are queries to determine if KTLS is enabled for either
reading or writing.  These control reuquest return 1 if KTLS is
enabled and 0 if it is not.

serf includes two custom BIO classes for wrapping I/O requests from
files and from a buffer in memory.  These BIO classes both use a
custom control method.  However, this custom control method was
returning 1 for unknown or unsupported control requests instead of 0.
As a result, OpenSSL with KTLS believed that these BIOs were using
KTLS and were thus adding headers and doing encryption/decryption in
the BIO.  Correcting the return value removes this confusion.

PR:		253135
Reported by:	Guido Falsi <mad@madpilot.net>
Reviewed by:	emaste
MFC after:	3 days
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D28472
2021-02-03 14:59:32 -08:00
..
auth Update Apache Serf to 1.3.9 to support OpenSSL 1.1.1. 2018-10-09 15:28:06 +00:00
buckets serf: Fix the default return value of the BIO control method. 2021-02-03 14:59:32 -08:00
build Update Apache Serf to 1.3.9 to support OpenSSL 1.1.1. 2018-10-09 15:28:06 +00:00
CHANGES Update Apache Serf to 1.3.9 to support OpenSSL 1.1.1. 2018-10-09 15:28:06 +00:00
context.c Update Apache Serf to 1.3.9 to support OpenSSL 1.1.1. 2018-10-09 15:28:06 +00:00
design-guide.txt
incoming.c Update Apache Serf to 1.3.9 to support OpenSSL 1.1.1. 2018-10-09 15:28:06 +00:00
LICENSE
NOTICE Update Apache Serf to 1.3.9 to support OpenSSL 1.1.1. 2018-10-09 15:28:06 +00:00
outgoing.c Update Apache Serf to 1.3.9 to support OpenSSL 1.1.1. 2018-10-09 15:28:06 +00:00
README Update Apache Serf to 1.3.9 to support OpenSSL 1.1.1. 2018-10-09 15:28:06 +00:00
SConstruct Update Apache Serf to 1.3.9 to support OpenSSL 1.1.1. 2018-10-09 15:28:06 +00:00
serf_bucket_types.h Update Apache Serf to 1.3.9 to support OpenSSL 1.1.1. 2018-10-09 15:28:06 +00:00
serf_bucket_util.h Update Apache Serf to 1.3.9 to support OpenSSL 1.1.1. 2018-10-09 15:28:06 +00:00
serf_private.h Update Apache Serf to 1.3.9 to support OpenSSL 1.1.1. 2018-10-09 15:28:06 +00:00
serf.h Update Apache Serf to 1.3.9 to support OpenSSL 1.1.1. 2018-10-09 15:28:06 +00:00
ssltunnel.c Update Apache Serf to 1.3.9 to support OpenSSL 1.1.1. 2018-10-09 15:28:06 +00:00
STATUS Update Apache Serf to 1.3.9 to support OpenSSL 1.1.1. 2018-10-09 15:28:06 +00:00

Welcome to Apache Serf, a high-performance asynchronous HTTP client library.

The Apache Serf library is a C-based HTTP client library built upon the Apache
Portable Runtime (APR) library. It multiplexes connections, running the
read/write communication asynchronously. Memory copies and transformations are
kept to a minimum to provide high performance operation.

  * Site: http://serf.apache.org//
  * Code: http://svn.apache.org/repos/asf/serf/
  * Issues: https://issues.apache.org/jira/browse/SERF
  * Mail: dev@serf.apache.org
  * People: Justin Erenkrantz, Greg Stein 

----

1. INSTALL

1.1. SCons build system

Apache Serf uses SCons 2.3 for its build system. If it is not installed
on your system, then you can install it onto your system. If you do not
have permissions, then you can download and install the "local"
version into your home directory. When installed privately, simply
create a symlink for 'scons' in your PATH to /path/to/scons/scons.py.

Fetch the scons-local package:
  http://prdownloads.sourceforge.net/scons/scons-local-2.3.0.tar.gz


1.2 Building Apache Serf

To build serf:

$ scons APR=/path/to/apr APU=/path/to/apu OPENSSL=/openssl/base PREFIX=/path/to/prefix

The switches are recorded into .saved_config, so they only need to be
specified the first time scons is run.

PREFIX should specify where serf should be installed.  PREFIX defaults to
/usr/local.

The default for the other three switches (APR, APU, OPENSSL) is /usr.

The build system looks for apr-1-config at $APR/bin/apr-1-config, or
the path should indicate apr-1-config itself. Similarly for the path
to apu-1-config.

OPENSSL should specify the root of the install (eg. /opt/local). The
includes will be found OPENSSL/include and libraries at OPENSSL/lib.

If you wish to use VPATH-style builds (where objects are created in a
distinct directory from the source), you can use:

$ scons -Y /path/to/serf/source

If you plan to install the library on a system that uses different
paths for architecture dependent files, specify LIBDIR. LIBDIR defaults
to /usr/local/lib otherwise. Example for a 64 bit GNU/Linux system:

$ scons PREFIX=/usr/ LIBDIR=/usr/lib64

At any point, the current settings can be examined:

$ scons --help


1.3 Running the test suite

$ scons check


1.4 Installing Apache Serf

$ scons install

Note that the PREFIX variable should have been specified in a previous
invocation of scons (and saved into .saved_config), or it can be
specified on the install command line:

$ scons PREFIX=/some/path install

Distribution package maintainers regulary install to a buildroot, and
would normally use something like below in their build systems, with
placeholders for the specific paths:

$ scons PREFIX=/usr/ LIBDIR=/usr/lib64
$ scons install --install-sandbox=/path/to/buildroot


1.4 Cleaning up the build

$ scons -c