SSL: stop accessing SSL_SESSION's fields directly.

SSL_SESSION struct is internal part of the OpenSSL library and it's fields
should be accessed via API (when exposed), not directly.

The unfortunate side-effect of this change is that we're losing reference
count that used to be printed at the debug log level, but this seems to be
an acceptable trade-off.

Almost fixes build with -DOPENSSL_NO_SSL_INTERN.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
Style: add whitespace between control statement and parentheses.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
Style: remove whitespace between function name and parentheses.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
Style: keep return type and function name on different lines.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
Style: use ngx_memcpy() instead of memcpy().

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
Style: fix typo.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
SPDY: fix support for headers with multiple values.

Split SPDY header with multiple, NULL-separated values:

    cookie: foo\0bar

into two separate HTTP headers with the same name:

    cookie: foo
    cookie: bar

Even though the logic for this behavior already existed
in the source code, it doesn't look that it ever worked
and SPDY streams with such headers were simply rejected.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
Style: use ngx_strlen() instead of strlen().
Style: use ngx_str_null().
Style: use ngx_str_set().
Core: bugfix for the ngx_slab_max_size case.
SSL: fix build with recent OpenSSL.

X509_check_host() prototype changed recently:
- http://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff;h=ced3d91
- http://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff;h=297c67f

Bump version requirement, so that OpenSSL-1.0.2-beta1 uses fallback code.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>