Commit Graph

255 Commits

Author SHA1 Message Date
8a6e1c3ada core: core output filter optimizations.
The core output filter used to determine first if it needed to block before
trying to send its data (including set aside ones), and if so it did call
send_brigade_blocking().

This can be avoided by making send_brigade_nonblocking() send as much data as
possible (nonblocking), and only if data remain check whether they should be
flushed (blocking), according to the same ap_filter_reinstate_brigade()
heuristics but afterward.

This allows both to simplify the code (axe send_brigade_blocking and some
duplicated logic) and optimize sends since send_brigade_nonblocking() is now
given all the buckets so it can make use of scatter/gather (iovec) or NOPUSH
option with the whole picture.

When sendfile is available and/or with fine tuning of FlushMaxThreshold (and
ReadBufferSize) from r1836032, one can now take advantage of modern network
speeds and bandwidth.

This commit also adds some APLOG_TRACE6 messages for outputed bytes (including
at mod_ssl level since splitting happens there when it's active).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1836237 13f79535-47bb-0310-9956-ffa450edef68
2018-07-18 21:55:29 +00:00
31a4103652 mod_ssl, ab: compatibility with LibreSSL. PR 61184.
LibreSSL defines OPENSSL_VERSION_NUMBER = 2.0, but is not compatible with
all of the latest OpenSSL 1.1 API.

Address this by defining MODSSL_USE_OPENSSL_PRE_1_1_API which is true for
anything but OpenSSL >= 1.1 (for now).

Proposed by: Bernard Spil <brnrd freebsd.org>
Reviewed by: ylavic



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1803396 13f79535-47bb-0310-9956-ffa450edef68
2017-07-29 23:05:02 +00:00
11250ebd61 mod_ssl: fix ctx passed to ssl_io_filter_error()
Consistently pass the expected bio_filter_in_ctx_t
to ssl_io_filter_error(). 

Submitted By: Yann Ylavic
CVEID: CVE-2017-3169


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1796343 13f79535-47bb-0310-9956-ffa450edef68
2017-05-26 21:09:32 +00:00
43a1396988 mod_ssl: don't depend on the next output filters to cleanup the passed out
brigades.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1781582 13f79535-47bb-0310-9956-ffa450edef68
2017-02-03 17:32:32 +00:00
2d74fe1ab1 ssl: clear the error queue before SSL_read/write/accept()
If other modules or libraries do not clear the OpenSSL error queue after
a failed operation, other code that relies on SSL_get_error() -- in
particular, code that deals with SSL_ERROR_WANT_READ/WRITE logic -- will
malfunction later on. To prevent this, explicitly clear the error queue
before calls like SSL_read/write/accept().

PR: 60223
Submitted by: Paul Spangler <paul.spangler ni.com>

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1769332 13f79535-47bb-0310-9956-ffa450edef68
2016-11-11 19:38:28 +00:00
d79b514c4b Fix spelling in comments and text files.
No functional change.
PR 59990


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1756038 13f79535-47bb-0310-9956-ffa450edef68
2016-08-11 19:50:02 +00:00
40581f8465 Correct the behavior and interaction between SSLProxyCheckPeer[CN|Name],
such that disabling either disables both, and that enabling either will
trigger the more comprehensive SSLProxyCheckPeerName behavior.

Only a single configuration remains to enable the legacy behavior, which
is to explicitly disable SSLProxyCheckPeerName and enable SSLProxyCheckPeerCN.

Changes to the proxy config directives leads us to a different 2.4 fix...
https://github.com/wrowe/patches/blob/master/fix_proxy_check_peer-2.4.x.patch


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1746647 13f79535-47bb-0310-9956-ffa450edef68
2016-06-02 22:31:35 +00:00
f9ad2754f7 mod_proxy, mod_ssl: Handle SSLProxy* directives in <Proxy> sections,
allowing per backend TLS configuration.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1740928 13f79535-47bb-0310-9956-ffa450edef68
2016-04-26 00:04:57 +00:00
f31ec0318d Support for OpenSSL 1.1.0:
- BIO was made opaque after OpenSSL 1.1.0pre4.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1737657 13f79535-47bb-0310-9956-ffa450edef68
2016-04-04 11:33:31 +00:00
d0365b7f28 mod_ssl: follow up to r1729208: add missing APLOGNO()s.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1732955 13f79535-47bb-0310-9956-ffa450edef68
2016-02-29 21:57:07 +00:00
dc83621bcd apr_strtok minor invocation change to maybe what everyone is used to
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1729782 13f79535-47bb-0310-9956-ffa450edef68
2016-02-11 09:18:25 +00:00
9aa81e10a6 * Fix compiler warning of unused variable
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1729700 13f79535-47bb-0310-9956-ffa450edef68
2016-02-10 19:35:34 +00:00
a5511fe280 let proxy handler forward ALPN protocol strings for ssl proxy connections
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1729208 13f79535-47bb-0310-9956-ffa450edef68
2016-02-08 16:50:07 +00:00
69ad717ab5 Fix some duplicate definitions
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1726888 13f79535-47bb-0310-9956-ffa450edef68
2016-01-26 20:30:28 +00:00
f0c57edf1c handling TIMEUP on SSL inputs by allowing later retries
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1725940 13f79535-47bb-0310-9956-ffa450edef68
2016-01-21 13:14:07 +00:00
af14d158a3 Added many log numbers to log statements that
had none.

Those were not detected by the coccinelle script.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1725485 13f79535-47bb-0310-9956-ffa450edef68
2016-01-19 12:02:41 +00:00
2b3237cd3b mod_ssl: follow up to r1723122, r1723143.
s/endb/upto/ in ssl_io_filter_coalesce() and update CHANGES to
include r1723143.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1723284 13f79535-47bb-0310-9956-ffa450edef68
2016-01-06 11:36:01 +00:00
315c1ceeed mod_ssl: follow up to r1723122.
Coalesce when (subsequent brigade's) data bucket is not last (likely followed
by FLUSH or EOS) but we have buffered data already.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1723143 13f79535-47bb-0310-9956-ffa450edef68
2016-01-05 18:06:23 +00:00
ae174ccc30 mod_ssl: Avoid one TLS record (application data) fragmentation by including
the last suitable bucket when coalescing.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1723122 13f79535-47bb-0310-9956-ffa450edef68
2016-01-05 16:52:29 +00:00
535e5efaf4 mod_ssl: fix build with openssl < 0.9.8m (missing semicolon).
Reported by: Petr Gajdos <pgajdos suse.cz>

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1719967 13f79535-47bb-0310-9956-ffa450edef68
2015-12-14 17:25:07 +00:00
b7693e5941 mod_ssl: follow up to r1709602.
Fix "HTTP spoken on HTTPS port" broken by the SSL handshake trigger moved to
process_connection hook (r1709602) along with H2Direct speculative read.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1715023 13f79535-47bb-0310-9956-ffa450edef68
2015-11-18 17:15:24 +00:00
ebb34c0b07 mod_ssl: performing protocol switch directly after ALPN selection, mod_http2: connection hook inits network filters to force TLS handshake, reads input only if H2Direct explicitly enabled, changes H2Direct default to off even for cleartext connections
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1708107 13f79535-47bb-0310-9956-ffa450edef68
2015-10-12 13:13:45 +00:00
5a18a6f89f mod_ssl: follow up to r1707230: fix (inverted) logic for SSL_in_connect_init().
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1707231 13f79535-47bb-0310-9956-ffa450edef68
2015-10-07 10:42:11 +00:00
dd73e48d20 mod_ssl: follow up to r1705823.
Flush SSL/TLS handshake data when writing (instead of before reading),
and only when necessary (openssl < 0.9.8m or proxy/client side).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1707230 13f79535-47bb-0310-9956-ffa450edef68
2015-10-07 10:38:53 +00:00
a8806f4fb2 mod_ssl: fix comment: alpn_proto_negotiated is now protocol_switch hook.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1707028 13f79535-47bb-0310-9956-ffa450edef68
2015-10-06 12:22:51 +00:00
615f97f933 core: Extend support for asynchronous write completion from the
network filter to any connection or request filter.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1706669 13f79535-47bb-0310-9956-ffa450edef68
2015-10-04 10:10:51 +00:00
697c9c3d14 mod_ssl: follow up to r1705823.
We still need to flush in the middle of a SSL/TLS handshake.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1706275 13f79535-47bb-0310-9956-ffa450edef68
2015-10-01 15:43:23 +00:00
d110d628a5 mod_ssl: pass through metadata buckets untouched in ssl_io_filter_output(),
the core output filter needs them.

Proposed by: jorton


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1705828 13f79535-47bb-0310-9956-ffa450edef68
2015-09-29 10:04:33 +00:00
314335ef62 mod_ssl: follow up to r1705823.
Oups, every #if needs a #endif...

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1705826 13f79535-47bb-0310-9956-ffa450edef68
2015-09-29 09:57:09 +00:00
6b54dd43b2 mod_ssl: don't FLUSH output (blocking) on read.
This defeats deferred write (and pipelining), eg. check_pipeline() is not
expecting the pipe to be flushed under it.
So let OpenSSL >= 0.9.8m issue the flush when necessary (earlier versions
are known to not handle all the cases, so we keep flushing with those).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1705823 13f79535-47bb-0310-9956-ffa450edef68
2015-09-29 09:42:56 +00:00
4c906045a6 Revert r1705236, better solution to come.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1705820 13f79535-47bb-0310-9956-ffa450edef68
2015-09-29 09:17:52 +00:00
696e52fa7e mod_ssl: don't FLUSH first for non blocking reads.
Such readers are prepared to receive empty data anyway (and take appropriate
action), while e.g. check_pipeline() is not expecting the pipe to be flushed
under it.

Reverted by: r1705820
Replaced by: r1705823


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1705236 13f79535-47bb-0310-9956-ffa450edef68
2015-09-25 07:27:04 +00:00
9aba39ee0c mod_ssl: forward EOR (only) brigades to the core_output_filter().
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1705194 13f79535-47bb-0310-9956-ffa450edef68
2015-09-24 23:13:03 +00:00
4c9b3c3b35 Support compilation against libssl built with OPENSSL_NO_SSL3,
and change the compiled-in default for SSL[Proxy]Protocol to "all -SSLv3",
in accordance with RFC 7568. PR 58349, PR 57120.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1703952 13f79535-47bb-0310-9956-ffa450edef68
2015-09-19 08:40:56 +00:00
c0d80cc90c adding ap_get_protocol(c) which safeguards against NULL returns, for use instead of direct calling ap_run_protocol_get
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1697855 13f79535-47bb-0310-9956-ffa450edef68
2015-08-26 08:58:45 +00:00
8ddd55a110 fix a warning.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1696566 13f79535-47bb-0310-9956-ffa450edef68
2015-08-19 11:50:35 +00:00
b9ba839d50 new Protocols directive and core API changes to enable protocol switching on HTTP Upgrade or ALPN, implemented in mod_ssl and mod_h2
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1692486 13f79535-47bb-0310-9956-ffa450edef68
2015-07-24 12:09:44 +00:00
d9a3b78926 s/\<\(\w\+\)\>\s\+\<\1\>/\1/g
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1690137 13f79535-47bb-0310-9956-ffa450edef68
2015-07-09 18:07:50 +00:00
a5d078e9b8 mod_ssl namespacing: SSL_X509_match_name -> modssl_X509_match_name
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1677156 13f79535-47bb-0310-9956-ffa450edef68
2015-05-01 14:42:42 +00:00
bb903996bf mod_ssl namespacing: SSL_smart_shutdown -> modssl_smart_shutdown
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1677145 13f79535-47bb-0310-9956-ffa450edef68
2015-05-01 14:10:23 +00:00
8063d62287 Formatting and wording improvements for ALPN (no code changes)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1676709 13f79535-47bb-0310-9956-ffa450edef68
2015-04-29 10:27:32 +00:00
6dd2a90084 Remove NPN support and focus on ALPN (RFC 7301)
* modules/ssl/mod_ssl.c, modules/ssl/mod_ssl.h: drop
  modssl_register_npn optional function and related declarations.

* modules/ssl/ssl_engine_init.c (ssl_init_ctx_callbacks):
  no longer set NPN advertisement callback.

* modules/ssl/ssl_engine_io.c (ssl_io_filter_input): remove
  NPN handling.

* modules/ssl/ssl_engine_kernel.c (ssl_callback_AdvertiseNextProtos):
  remove callback.

* modules/ssl/ssl_private.h: remove NPN prototypes, set
  HAVE_TLS_ALPN (OpenSSL 1.0.2 and later) with feature-based detection.

Rename SSLAlpnPreference to SSLALPNPreference, and add documentation.

Previous commits related to NPN and ALPN, for reference purposes:

r1332643 - Add support for TLS Next Protocol Negotiation
r1487772 - mod_ssl: Redesign NPN (Next Protocol Negotiation) API
           to avoid use of hooks API and inter-module hard linkage
r1670397 - ALPN support, based on mod_spdy/mod_h2 patch set
r1670434 - More ALPN goodness

(plus some minor tweaks: r1670578, r1670440, r1670578,
 r1670738, r1675459, and r1675549)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1676004 13f79535-47bb-0310-9956-ffa450edef68
2015-04-25 09:46:09 +00:00
4c43036c9e mod_ssl namespacing: Rename ssl_util_ssl.h macros from SSL_foo to MODSSL_foo.
For related discussion, see the dev@ thread starting at:
http://mail-archives.apache.org/mod_mbox/httpd-dev/201504.mbox/%3C20150415163613.GC15209%40fintan.stsp.name%3E


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1674538 13f79535-47bb-0310-9956-ffa450edef68
2015-04-18 16:43:34 +00:00
31c3573052 Followup to r1670397: add missing APLOGNO.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1670432 13f79535-47bb-0310-9956-ffa450edef68
2015-03-31 19:09:12 +00:00
17565ac48c ALPN support, based on mod_spdy/mod_h2 patch set
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1670397 13f79535-47bb-0310-9956-ffa450edef68
2015-03-31 17:12:51 +00:00
0a431ef862 core, modules: like r1657897 but for core and other modules than mod_proxy.
More uses of ap_map_http_request_error() and AP_FILTER_ERROR so that we never
return an HTTP error status from a handler if some filter generated a response
already.

That is, from a handler, either ap_get_brigade() (an input filter) returned
AP_FILTER_ERROR and we must forward it to ap_die(), or ap_pass_brigade() (an
output filter) failed with any status and we must return AP_FILTER_ERROR in
any case for ap_die() to determine whether a response is needed or not.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1665625 13f79535-47bb-0310-9956-ffa450edef68
2015-03-10 17:25:17 +00:00
8e416f19be ssl_io_filter_handshake(): When a post-handshake check fails,
return an error code understood by ssl_io_filter_error().

That function needs to perform error handling, and a valid
apr_status_t needs to be returned up.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1645529 13f79535-47bb-0310-9956-ffa450edef68
2014-12-14 21:48:25 +00:00
00e4c4fbc9 tab vs space
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1633530 13f79535-47bb-0310-9956-ffa450edef68
2014-10-22 05:25:02 +00:00
d8fd328cfb mod_ssl: Fix SSL_CLIENT_VERIFY value when "SSLVerifyClient optional_no_ca" and
SSLSessionCache are used and SSL session is resumed. SSL_CLIENT_VERIFY value
has been set to SUCCESS on resumption even when originally it was set to
GENEROUS. PR 53193.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1633085 13f79535-47bb-0310-9956-ffa450edef68
2014-10-20 09:18:22 +00:00
c14ecfa1dd mod_ssl: dump SSL IO/state for the write side of the connection(s), like reads.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1601919 13f79535-47bb-0310-9956-ffa450edef68
2014-06-11 14:42:32 +00:00