http-relay should be avoided due to CVE-2009-0801. It was implemented to
support ancient HTTP/1.0 clients that did not set `Host` header, so
upstream proxy had at least some way to determine request destination.
In modern post-SPDY world this method should not be used, you should
rather configure upstream proxy to accept CONNECT requests to any port
and use `http-connect` instead.
Great CVE-2009-0801 description can be found in squid-users on 2015-12-18
http://lists.squid-cache.org/pipermail/squid-users/2015-December/008392.html
It gives ~33% increase of throughput on CPU-bound box. E.g. following
machine single-connection throughput goes from ~30 Mbit/s to ~40 Mbit/s
system type: xRX200 rev 1.2
machine: TDW8980 - TP-LINK TD-W8980
cpu model: MIPS 34Kc V5.6
BogoMIPS: 332.54
Some errors are not stored in SO_ERROR. Moreover, libevent uses SO_ERROR
itself and SO_ERROR is cleared after reading. Probably, using SO_ERROR
is not a good idea at all, but I have no proper test-case checking if
it's safe to remove SO_ERROR code.
log_debug and log_info should not waste CPU and disk space while logging
to file and stderr, but SIGUSR1 dump is explicit request, so it's always
logged.
Use _XOPEN_SOURCE=600 to make system headers expose Single UNIX
Specification v3 (SUSv3) definitions, i.e. POSIX.1-2001 base
specification plus the X/Open System Interface (XSI) extension.
POSIX.1-2001 is aligned with C99, so that all of the library
functions standardized in C99 are also standardized in POSIX.1-2001.
Use _BSD_SOURCE together with _DEFAULT_SOURCE to compile without
warnings in glibc <= 2.19 and glibc >= 2.20 (_BSD_SOURCE is deprecated
since glibc 2.20 and it has same effect as defining _DEFAULT_SOURCE
but generates a compile-time warning if used alone). This is required
for availability of non-POSIX functions, like inet_aton() or timercmp(),
that are present on most BSD derivatives.
Note: _DEFAULT_SOURCE, which was introduced in glibc 2.19, will actually
bump _POSIX_C_SOURCE from 200112L to 200809L, but it brings no harm.
__typeof adheres to ISO C standard as it is reserved identifier [1],
so it is collision-free and works in non-GNU mode as long as compiler
supports it.
[1] C99: "All identifiers that begin with an underscore and either an
uppercase letter or another underscore are always reserved for any use."
Statement expression is GNU C extension, not present in ISO standard.
Type checking works now via implicit conversion performed for compound
literal (compound literals are available since C99). typeof is only used
on GNUC compilers like gcc or clang.