2004-07-16 14:33:35 +08:00
|
|
|
|
2004-09-28 16:34:51 +08:00
|
|
|
/*
|
2004-09-30 00:00:49 +08:00
|
|
|
* Copyright (C) Igor Sysoev
|
2004-09-28 16:34:51 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2004-07-16 00:35:51 +08:00
|
|
|
#include <ngx_config.h>
|
|
|
|
#include <ngx_core.h>
|
2004-07-16 14:33:35 +08:00
|
|
|
#include <ngx_event.h>
|
2004-07-16 00:35:51 +08:00
|
|
|
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 21:03:58 +08:00
|
|
|
#include <openssl/engine.h>
|
|
|
|
|
2004-07-16 00:35:51 +08:00
|
|
|
|
2005-02-16 21:40:36 +08:00
|
|
|
static ngx_int_t ngx_ssl_handle_recv(ngx_connection_t *c, int n);
|
2004-12-03 02:40:46 +08:00
|
|
|
static void ngx_ssl_write_handler(ngx_event_t *wev);
|
2004-11-26 00:17:31 +08:00
|
|
|
static ssize_t ngx_ssl_write(ngx_connection_t *c, u_char *data, size_t size);
|
2004-12-03 02:40:46 +08:00
|
|
|
static void ngx_ssl_read_handler(ngx_event_t *rev);
|
2004-07-23 13:37:29 +08:00
|
|
|
|
|
|
|
|
2005-02-16 21:40:36 +08:00
|
|
|
ngx_int_t
|
|
|
|
ngx_ssl_init(ngx_log_t *log)
|
2004-07-16 00:35:51 +08:00
|
|
|
{
|
|
|
|
SSL_library_init();
|
|
|
|
SSL_load_error_strings();
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 21:03:58 +08:00
|
|
|
ENGINE_load_builtin_engines();
|
2004-07-16 00:35:51 +08:00
|
|
|
|
|
|
|
return NGX_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-02-16 21:40:36 +08:00
|
|
|
ngx_int_t
|
|
|
|
ngx_ssl_create_session(ngx_ssl_ctx_t *ssl_ctx, ngx_connection_t *c,
|
|
|
|
ngx_uint_t flags)
|
2004-07-16 00:35:51 +08:00
|
|
|
{
|
|
|
|
ngx_ssl_t *ssl;
|
|
|
|
|
2005-03-19 20:38:37 +08:00
|
|
|
ssl = ngx_pcalloc(c->pool, sizeof(ngx_ssl_t));
|
|
|
|
if (ssl == NULL) {
|
2004-07-17 01:11:43 +08:00
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
2004-07-16 00:35:51 +08:00
|
|
|
|
2005-03-19 20:38:37 +08:00
|
|
|
ssl->buf = ngx_create_temp_buf(c->pool, NGX_SSL_BUFSIZE);
|
|
|
|
if (ssl->buf == NULL) {
|
2004-07-23 13:37:29 +08:00
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
2004-07-17 01:11:43 +08:00
|
|
|
if (flags & NGX_SSL_BUFFER) {
|
2004-07-23 13:37:29 +08:00
|
|
|
ssl->buffer = 1;
|
2004-07-17 01:11:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
ssl->ssl = SSL_new(ssl_ctx);
|
|
|
|
|
|
|
|
if (ssl->ssl == NULL) {
|
|
|
|
ngx_ssl_error(NGX_LOG_ALERT, c->log, 0, "SSL_new() failed");
|
2004-07-16 00:35:51 +08:00
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
2004-07-17 01:11:43 +08:00
|
|
|
if (SSL_set_fd(ssl->ssl, c->fd) == 0) {
|
|
|
|
ngx_ssl_error(NGX_LOG_ALERT, c->log, 0, "SSL_set_fd() failed");
|
2004-07-16 00:35:51 +08:00
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
2004-07-17 01:11:43 +08:00
|
|
|
SSL_set_accept_state(ssl->ssl);
|
2004-07-16 00:35:51 +08:00
|
|
|
|
|
|
|
c->ssl = ssl;
|
|
|
|
|
|
|
|
return NGX_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-02-16 21:40:36 +08:00
|
|
|
ssize_t
|
|
|
|
ngx_ssl_recv(ngx_connection_t *c, u_char *buf, size_t size)
|
2004-07-16 00:35:51 +08:00
|
|
|
{
|
2005-02-16 21:40:36 +08:00
|
|
|
int n, bytes;
|
2004-07-16 00:35:51 +08:00
|
|
|
|
2005-02-16 21:40:36 +08:00
|
|
|
if (c->ssl->last == NGX_ERROR) {
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
2004-07-16 00:35:51 +08:00
|
|
|
|
2005-02-16 21:40:36 +08:00
|
|
|
bytes = 0;
|
2004-07-16 00:35:51 +08:00
|
|
|
|
2005-02-16 21:40:36 +08:00
|
|
|
/*
|
|
|
|
* SSL_read() may return data in parts, so try to read
|
|
|
|
* until SSL_read() would return no data
|
|
|
|
*/
|
|
|
|
|
|
|
|
for ( ;; ) {
|
|
|
|
|
|
|
|
n = SSL_read(c->ssl->ssl, buf, size);
|
|
|
|
|
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, "SSL_read: %d", n);
|
|
|
|
|
|
|
|
if (n > 0) {
|
|
|
|
|
|
|
|
bytes += n;
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 21:03:58 +08:00
|
|
|
|
|
|
|
#if (NGX_DEBUG)
|
|
|
|
|
2005-02-16 21:40:36 +08:00
|
|
|
if (!c->ssl->handshaked && SSL_is_init_finished(c->ssl->ssl)) {
|
|
|
|
char buf[129], *s, *d;
|
|
|
|
SSL_CIPHER *cipher;
|
|
|
|
|
|
|
|
c->ssl->handshaked = 1;
|
|
|
|
|
|
|
|
cipher = SSL_get_current_cipher(c->ssl->ssl);
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 21:03:58 +08:00
|
|
|
|
2005-02-16 21:40:36 +08:00
|
|
|
if (cipher) {
|
|
|
|
SSL_CIPHER_description(cipher, &buf[1], 128);
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 21:03:58 +08:00
|
|
|
|
2005-02-16 21:40:36 +08:00
|
|
|
for (s = &buf[1], d = buf; *s; s++) {
|
|
|
|
if (*s == ' ' && *d == ' ') {
|
|
|
|
continue;
|
|
|
|
}
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 21:03:58 +08:00
|
|
|
|
2005-02-17 19:59:36 +08:00
|
|
|
if (*s == LF || *s == CR) {
|
2005-02-16 21:40:36 +08:00
|
|
|
continue;
|
|
|
|
}
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 21:03:58 +08:00
|
|
|
|
2005-02-16 21:40:36 +08:00
|
|
|
*++d = *s;
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 21:03:58 +08:00
|
|
|
}
|
|
|
|
|
2005-02-16 21:40:36 +08:00
|
|
|
if (*d != ' ') {
|
|
|
|
d++;
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 21:03:58 +08:00
|
|
|
}
|
|
|
|
|
2005-02-16 21:40:36 +08:00
|
|
|
*d = '\0';
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 21:03:58 +08:00
|
|
|
|
2005-02-16 21:40:36 +08:00
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0,
|
|
|
|
"SSL cipher: \"%s\"", &buf[1]);
|
|
|
|
} else {
|
|
|
|
ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0,
|
|
|
|
"SSL no shared ciphers");
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 21:03:58 +08:00
|
|
|
}
|
2005-02-16 21:40:36 +08:00
|
|
|
}
|
|
|
|
#endif
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 21:03:58 +08:00
|
|
|
|
2005-02-16 21:40:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
c->ssl->last = ngx_ssl_handle_recv(c, n);
|
|
|
|
|
|
|
|
if (c->ssl->last != NGX_OK) {
|
|
|
|
|
|
|
|
if (bytes) {
|
|
|
|
return bytes;
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 21:03:58 +08:00
|
|
|
|
|
|
|
} else {
|
2005-02-16 21:40:36 +08:00
|
|
|
return c->ssl->last;
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 21:03:58 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-02-16 21:40:36 +08:00
|
|
|
size -= n;
|
|
|
|
|
|
|
|
if (size == 0) {
|
|
|
|
return bytes;
|
|
|
|
}
|
|
|
|
|
|
|
|
buf += n;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static ngx_int_t
|
|
|
|
ngx_ssl_handle_recv(ngx_connection_t *c, int n)
|
|
|
|
{
|
|
|
|
int sslerr;
|
|
|
|
ngx_err_t err;
|
|
|
|
char *handshake;
|
|
|
|
|
|
|
|
if (n > 0) {
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 21:03:58 +08:00
|
|
|
|
2004-12-03 02:40:46 +08:00
|
|
|
if (c->ssl->saved_write_handler) {
|
|
|
|
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 22:58:06 +08:00
|
|
|
c->write->handler = c->ssl->saved_write_handler;
|
2004-12-03 02:40:46 +08:00
|
|
|
c->ssl->saved_write_handler = NULL;
|
|
|
|
c->write->ready = 1;
|
|
|
|
|
|
|
|
if (ngx_handle_write_event(c->write, 0) == NGX_ERROR) {
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ngx_mutex_lock(ngx_posted_events_mutex) == NGX_ERROR) {
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
ngx_post_event(c->write);
|
|
|
|
|
|
|
|
ngx_mutex_unlock(ngx_posted_events_mutex);
|
|
|
|
}
|
|
|
|
|
2005-02-16 21:40:36 +08:00
|
|
|
return NGX_OK;
|
2004-07-16 00:35:51 +08:00
|
|
|
}
|
|
|
|
|
2004-10-11 23:07:03 +08:00
|
|
|
if (!SSL_is_init_finished(c->ssl->ssl)) {
|
2004-11-11 22:07:14 +08:00
|
|
|
handshake = " in SSL handshake";
|
2004-10-11 23:07:03 +08:00
|
|
|
|
|
|
|
} else {
|
|
|
|
handshake = "";
|
|
|
|
}
|
|
|
|
|
2004-07-17 01:11:43 +08:00
|
|
|
sslerr = SSL_get_error(c->ssl->ssl, n);
|
|
|
|
|
|
|
|
err = (sslerr == SSL_ERROR_SYSCALL) ? ngx_errno : 0;
|
2004-07-16 00:35:51 +08:00
|
|
|
|
2004-07-19 03:11:20 +08:00
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, "SSL_get_error: %d", sslerr);
|
|
|
|
|
2004-07-17 01:11:43 +08:00
|
|
|
if (sslerr == SSL_ERROR_WANT_READ) {
|
2004-10-21 23:34:38 +08:00
|
|
|
c->read->ready = 0;
|
2004-07-16 00:35:51 +08:00
|
|
|
return NGX_AGAIN;
|
|
|
|
}
|
2004-07-16 14:33:35 +08:00
|
|
|
|
2004-07-17 01:11:43 +08:00
|
|
|
if (sslerr == SSL_ERROR_WANT_WRITE) {
|
2004-09-30 14:38:49 +08:00
|
|
|
ngx_log_error(NGX_LOG_ALERT, c->log, err,
|
|
|
|
"SSL wants to write%s", handshake);
|
2004-12-03 02:40:46 +08:00
|
|
|
|
|
|
|
c->write->ready = 0;
|
|
|
|
|
|
|
|
if (ngx_handle_write_event(c->write, 0) == NGX_ERROR) {
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* we do not set the timer because there is already the read event timer
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (c->ssl->saved_write_handler == NULL) {
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 22:58:06 +08:00
|
|
|
c->ssl->saved_write_handler = c->write->handler;
|
|
|
|
c->write->handler = ngx_ssl_write_handler;
|
2004-12-03 02:40:46 +08:00
|
|
|
}
|
|
|
|
|
2004-07-16 00:35:51 +08:00
|
|
|
return NGX_AGAIN;
|
2004-09-30 14:38:49 +08:00
|
|
|
}
|
2004-07-16 00:35:51 +08:00
|
|
|
|
2004-07-19 03:11:20 +08:00
|
|
|
c->ssl->no_rcv_shut = 1;
|
2004-12-03 02:40:46 +08:00
|
|
|
c->ssl->no_send_shut = 1;
|
2004-07-19 03:11:20 +08:00
|
|
|
|
2004-07-17 01:11:43 +08:00
|
|
|
if (sslerr == SSL_ERROR_ZERO_RETURN || ERR_peek_error() == 0) {
|
|
|
|
ngx_log_error(NGX_LOG_INFO, c->log, err,
|
2004-07-16 00:35:51 +08:00
|
|
|
"client closed connection%s", handshake);
|
|
|
|
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
2004-07-17 01:11:43 +08:00
|
|
|
ngx_ssl_error(NGX_LOG_ALERT, c->log, err,
|
|
|
|
"SSL_read() failed%s", handshake);
|
2004-07-16 00:35:51 +08:00
|
|
|
|
2004-07-16 14:33:35 +08:00
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-02-16 21:40:36 +08:00
|
|
|
static void
|
|
|
|
ngx_ssl_write_handler(ngx_event_t *wev)
|
2004-12-03 02:40:46 +08:00
|
|
|
{
|
|
|
|
ngx_connection_t *c;
|
|
|
|
|
|
|
|
c = wev->data;
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 22:58:06 +08:00
|
|
|
c->read->handler(c->read);
|
2004-12-03 02:40:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-07-24 01:05:37 +08:00
|
|
|
/*
|
|
|
|
* OpenSSL has no SSL_writev() so we copy several bufs into our 16K buffer
|
2004-12-03 02:40:46 +08:00
|
|
|
* before the SSL_write() call to decrease a SSL overhead.
|
2004-07-24 01:05:37 +08:00
|
|
|
*
|
|
|
|
* Besides for protocols such as HTTP it is possible to always buffer
|
|
|
|
* the output to decrease a SSL overhead some more.
|
|
|
|
*/
|
|
|
|
|
2005-02-16 21:40:36 +08:00
|
|
|
ngx_chain_t *
|
|
|
|
ngx_ssl_send_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
|
2004-07-16 14:33:35 +08:00
|
|
|
{
|
2004-07-23 13:37:29 +08:00
|
|
|
int n;
|
2004-07-26 02:34:14 +08:00
|
|
|
ngx_uint_t flush;
|
2004-07-23 13:37:29 +08:00
|
|
|
ssize_t send, size;
|
|
|
|
ngx_buf_t *buf;
|
2004-07-16 14:33:35 +08:00
|
|
|
|
2004-07-17 01:11:43 +08:00
|
|
|
buf = c->ssl->buf;
|
|
|
|
|
2004-07-26 02:34:14 +08:00
|
|
|
if (in && in->next == NULL && !c->buffered && !c->ssl->buffer) {
|
2004-07-17 01:11:43 +08:00
|
|
|
|
2004-07-23 13:37:29 +08:00
|
|
|
/*
|
2004-07-24 01:05:37 +08:00
|
|
|
* we avoid a buffer copy if the incoming buf is a single,
|
|
|
|
* our buffer is empty, and we do not need to buffer the output
|
2004-07-23 13:37:29 +08:00
|
|
|
*/
|
2004-07-17 01:11:43 +08:00
|
|
|
|
2004-07-23 13:37:29 +08:00
|
|
|
n = ngx_ssl_write(c, in->buf->pos, in->buf->last - in->buf->pos);
|
2004-07-17 01:11:43 +08:00
|
|
|
|
2004-07-24 01:05:37 +08:00
|
|
|
if (n == NGX_ERROR) {
|
|
|
|
return NGX_CHAIN_ERROR;
|
|
|
|
}
|
|
|
|
|
2005-05-16 21:53:20 +08:00
|
|
|
if (n == NGX_AGAIN) {
|
|
|
|
c->buffered = 1;
|
|
|
|
return in;
|
2004-07-23 13:37:29 +08:00
|
|
|
}
|
2004-07-17 01:11:43 +08:00
|
|
|
|
2004-07-23 13:37:29 +08:00
|
|
|
in->buf->pos += n;
|
2004-07-17 01:11:43 +08:00
|
|
|
|
2004-07-23 13:37:29 +08:00
|
|
|
return in;
|
|
|
|
}
|
2004-07-17 01:11:43 +08:00
|
|
|
|
2004-12-03 02:40:46 +08:00
|
|
|
|
|
|
|
/* the maximum limit size is the maximum uint32_t value - the page size */
|
|
|
|
|
|
|
|
if (limit == 0 || limit > NGX_MAX_UINT32_VALUE - ngx_pagesize) {
|
|
|
|
limit = NGX_MAX_UINT32_VALUE - ngx_pagesize;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-07-23 13:37:29 +08:00
|
|
|
send = 0;
|
|
|
|
flush = (in == NULL) ? 1 : 0;
|
2004-07-17 01:11:43 +08:00
|
|
|
|
2004-07-23 13:37:29 +08:00
|
|
|
for ( ;; ) {
|
2004-07-17 01:11:43 +08:00
|
|
|
|
2004-07-23 13:37:29 +08:00
|
|
|
while (in && buf->last < buf->end) {
|
|
|
|
if (in->buf->last_buf) {
|
|
|
|
flush = 1;
|
2004-07-17 01:11:43 +08:00
|
|
|
}
|
|
|
|
|
2004-07-23 13:37:29 +08:00
|
|
|
if (ngx_buf_special(in->buf)) {
|
2004-07-24 01:05:37 +08:00
|
|
|
in = in->next;
|
2004-07-23 13:37:29 +08:00
|
|
|
continue;
|
2004-07-17 01:11:43 +08:00
|
|
|
}
|
|
|
|
|
2004-07-23 13:37:29 +08:00
|
|
|
size = in->buf->last - in->buf->pos;
|
2004-07-17 01:11:43 +08:00
|
|
|
|
2004-07-23 13:37:29 +08:00
|
|
|
if (size > buf->end - buf->last) {
|
|
|
|
size = buf->end - buf->last;
|
|
|
|
}
|
2004-07-17 01:11:43 +08:00
|
|
|
|
2004-07-23 13:37:29 +08:00
|
|
|
/*
|
|
|
|
* TODO: the taking in->buf->flush into account can be
|
2004-07-24 01:05:37 +08:00
|
|
|
* implemented using the limit on the higher level
|
2004-07-23 13:37:29 +08:00
|
|
|
*/
|
2004-07-17 01:11:43 +08:00
|
|
|
|
2004-07-23 13:37:29 +08:00
|
|
|
if (send + size > limit) {
|
|
|
|
size = limit - send;
|
|
|
|
flush = 1;
|
2004-07-17 01:11:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0,
|
2004-07-23 13:37:29 +08:00
|
|
|
"SSL buf copy: %d", size);
|
2004-07-17 01:11:43 +08:00
|
|
|
|
2004-07-23 13:37:29 +08:00
|
|
|
ngx_memcpy(buf->last, in->buf->pos, size);
|
2004-07-17 01:11:43 +08:00
|
|
|
|
2004-07-23 13:37:29 +08:00
|
|
|
buf->last += size;
|
2004-07-17 01:11:43 +08:00
|
|
|
|
2004-07-23 13:37:29 +08:00
|
|
|
in->buf->pos += size;
|
|
|
|
if (in->buf->pos == in->buf->last) {
|
|
|
|
in = in->next;
|
|
|
|
}
|
2004-07-17 01:11:43 +08:00
|
|
|
}
|
|
|
|
|
2004-07-23 13:37:29 +08:00
|
|
|
size = buf->last - buf->pos;
|
2004-07-17 01:11:43 +08:00
|
|
|
|
2004-07-24 01:05:37 +08:00
|
|
|
if (!flush && buf->last < buf->end && c->ssl->buffer) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
n = ngx_ssl_write(c, buf->pos, size);
|
2004-07-17 01:11:43 +08:00
|
|
|
|
2004-07-24 01:05:37 +08:00
|
|
|
if (n == NGX_ERROR) {
|
|
|
|
return NGX_CHAIN_ERROR;
|
2004-07-17 01:11:43 +08:00
|
|
|
}
|
|
|
|
|
2005-05-15 02:42:03 +08:00
|
|
|
if (n == NGX_AGAIN) {
|
|
|
|
c->buffered = 1;
|
|
|
|
return in;
|
2004-07-23 13:37:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
buf->pos += n;
|
|
|
|
send += n;
|
|
|
|
c->sent += n;
|
2004-07-17 01:11:43 +08:00
|
|
|
|
2004-07-23 13:37:29 +08:00
|
|
|
if (n < size) {
|
|
|
|
break;
|
2004-07-16 14:33:35 +08:00
|
|
|
}
|
|
|
|
|
2004-07-23 13:37:29 +08:00
|
|
|
if (buf->pos == buf->last) {
|
|
|
|
buf->pos = buf->start;
|
|
|
|
buf->last = buf->start;
|
|
|
|
}
|
2004-07-16 14:33:35 +08:00
|
|
|
|
2004-07-23 13:37:29 +08:00
|
|
|
if (in == NULL || send == limit) {
|
|
|
|
break;
|
2004-07-16 14:33:35 +08:00
|
|
|
}
|
2004-07-23 13:37:29 +08:00
|
|
|
}
|
2004-07-16 14:33:35 +08:00
|
|
|
|
2004-07-26 02:34:14 +08:00
|
|
|
c->buffered = (buf->pos < buf->last) ? 1 : 0;
|
2004-07-16 14:33:35 +08:00
|
|
|
|
2004-07-26 02:34:14 +08:00
|
|
|
return in;
|
2004-07-23 13:37:29 +08:00
|
|
|
}
|
2004-07-16 14:33:35 +08:00
|
|
|
|
|
|
|
|
2005-02-16 21:40:36 +08:00
|
|
|
static ssize_t
|
|
|
|
ngx_ssl_write(ngx_connection_t *c, u_char *data, size_t size)
|
2004-07-23 13:37:29 +08:00
|
|
|
{
|
2004-10-11 23:07:03 +08:00
|
|
|
int n, sslerr;
|
|
|
|
ngx_err_t err;
|
|
|
|
char *handshake;
|
2004-07-16 14:33:35 +08:00
|
|
|
|
2004-07-23 13:37:29 +08:00
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, "SSL to write: %d", size);
|
2004-07-16 14:33:35 +08:00
|
|
|
|
2004-07-23 13:37:29 +08:00
|
|
|
n = SSL_write(c->ssl->ssl, data, size);
|
|
|
|
|
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, "SSL_write: %d", n);
|
|
|
|
|
|
|
|
if (n > 0) {
|
2004-12-03 02:40:46 +08:00
|
|
|
if (c->ssl->saved_read_handler) {
|
|
|
|
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 22:58:06 +08:00
|
|
|
c->read->handler = c->ssl->saved_read_handler;
|
2004-12-03 02:40:46 +08:00
|
|
|
c->ssl->saved_read_handler = NULL;
|
|
|
|
c->read->ready = 1;
|
|
|
|
|
|
|
|
if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ngx_mutex_lock(ngx_posted_events_mutex) == NGX_ERROR) {
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
ngx_post_event(c->read);
|
|
|
|
|
|
|
|
ngx_mutex_unlock(ngx_posted_events_mutex);
|
|
|
|
}
|
|
|
|
|
2004-07-23 13:37:29 +08:00
|
|
|
return n;
|
|
|
|
}
|
2004-07-16 14:33:35 +08:00
|
|
|
|
2004-07-23 13:37:29 +08:00
|
|
|
sslerr = SSL_get_error(c->ssl->ssl, n);
|
2004-07-19 03:11:20 +08:00
|
|
|
|
2004-07-23 13:37:29 +08:00
|
|
|
err = (sslerr == SSL_ERROR_SYSCALL) ? ngx_errno : 0;
|
2004-07-16 14:33:35 +08:00
|
|
|
|
2004-07-23 13:37:29 +08:00
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, "SSL_get_error: %d", sslerr);
|
2004-07-16 14:33:35 +08:00
|
|
|
|
2004-07-23 13:37:29 +08:00
|
|
|
if (sslerr == SSL_ERROR_WANT_WRITE) {
|
|
|
|
c->write->ready = 0;
|
|
|
|
return NGX_AGAIN;
|
|
|
|
}
|
2004-07-16 14:33:35 +08:00
|
|
|
|
2004-07-23 13:37:29 +08:00
|
|
|
if (sslerr == SSL_ERROR_WANT_READ) {
|
2004-10-11 23:07:03 +08:00
|
|
|
|
|
|
|
if (!SSL_is_init_finished(c->ssl->ssl)) {
|
2004-11-11 22:07:14 +08:00
|
|
|
handshake = " in SSL handshake";
|
2004-10-11 23:07:03 +08:00
|
|
|
|
|
|
|
} else {
|
|
|
|
handshake = "";
|
|
|
|
}
|
|
|
|
|
2004-09-30 14:38:49 +08:00
|
|
|
ngx_log_error(NGX_LOG_ALERT, c->log, err,
|
|
|
|
"SSL wants to read%s", handshake);
|
2004-12-03 02:40:46 +08:00
|
|
|
|
|
|
|
c->read->ready = 0;
|
|
|
|
|
|
|
|
if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* we do not set the timer because there is already
|
|
|
|
* the write event timer
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (c->ssl->saved_read_handler == NULL) {
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 22:58:06 +08:00
|
|
|
c->ssl->saved_read_handler = c->read->handler;
|
|
|
|
c->read->handler = ngx_ssl_read_handler;
|
2004-12-03 02:40:46 +08:00
|
|
|
}
|
|
|
|
|
2004-07-23 13:37:29 +08:00
|
|
|
return NGX_AGAIN;
|
2004-10-11 23:07:03 +08:00
|
|
|
}
|
2004-07-16 14:33:35 +08:00
|
|
|
|
2004-07-23 13:37:29 +08:00
|
|
|
c->ssl->no_rcv_shut = 1;
|
2004-12-03 02:40:46 +08:00
|
|
|
c->ssl->no_send_shut = 1;
|
2004-07-16 14:33:35 +08:00
|
|
|
|
2004-07-23 13:37:29 +08:00
|
|
|
ngx_ssl_error(NGX_LOG_ALERT, c->log, err, "SSL_write() failed");
|
2004-07-16 14:33:35 +08:00
|
|
|
|
2004-07-23 13:37:29 +08:00
|
|
|
return NGX_ERROR;
|
2004-07-16 14:33:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-02-16 21:40:36 +08:00
|
|
|
static void
|
|
|
|
ngx_ssl_read_handler(ngx_event_t *rev)
|
2004-12-03 02:40:46 +08:00
|
|
|
{
|
|
|
|
ngx_connection_t *c;
|
|
|
|
|
|
|
|
c = rev->data;
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 22:58:06 +08:00
|
|
|
c->write->handler(c->write);
|
2004-12-03 02:40:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-02-16 21:40:36 +08:00
|
|
|
ngx_int_t
|
|
|
|
ngx_ssl_shutdown(ngx_connection_t *c)
|
2004-07-16 14:33:35 +08:00
|
|
|
{
|
2004-12-03 02:40:46 +08:00
|
|
|
int n, sslerr, mode;
|
2004-07-16 14:33:35 +08:00
|
|
|
ngx_uint_t again;
|
|
|
|
|
2004-12-03 02:40:46 +08:00
|
|
|
if (!c->ssl->shutdown_set) {
|
2004-07-16 00:35:51 +08:00
|
|
|
|
2004-12-03 02:40:46 +08:00
|
|
|
/* it seems that SSL_set_shutdown() could be called once only */
|
|
|
|
|
|
|
|
if (c->read->timedout) {
|
|
|
|
mode = SSL_RECEIVED_SHUTDOWN|SSL_SENT_SHUTDOWN;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
mode = 0;
|
|
|
|
|
|
|
|
if (c->ssl->no_rcv_shut) {
|
|
|
|
mode = SSL_RECEIVED_SHUTDOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (c->ssl->no_send_shut) {
|
|
|
|
mode |= SSL_SENT_SHUTDOWN;
|
|
|
|
}
|
2004-07-19 03:11:20 +08:00
|
|
|
}
|
|
|
|
|
2004-12-03 02:40:46 +08:00
|
|
|
if (mode) {
|
|
|
|
SSL_set_shutdown(c->ssl->ssl, mode);
|
|
|
|
c->ssl->shutdown_set = 1;
|
2004-07-19 03:11:20 +08:00
|
|
|
}
|
|
|
|
}
|
2004-07-16 14:33:35 +08:00
|
|
|
|
|
|
|
again = 0;
|
2004-11-11 22:07:14 +08:00
|
|
|
#if (NGX_SUPPRESS_WARN)
|
|
|
|
sslerr = 0;
|
|
|
|
#endif
|
2004-07-16 14:33:35 +08:00
|
|
|
|
|
|
|
for ( ;; ) {
|
2004-07-17 01:11:43 +08:00
|
|
|
n = SSL_shutdown(c->ssl->ssl);
|
2004-07-16 14:33:35 +08:00
|
|
|
|
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, "SSL_shutdown: %d", n);
|
|
|
|
|
2004-12-03 02:40:46 +08:00
|
|
|
if (n == 1 || (n == 0 && c->read->timedout)) {
|
2004-07-17 01:11:43 +08:00
|
|
|
SSL_free(c->ssl->ssl);
|
2004-07-16 14:33:35 +08:00
|
|
|
c->ssl = NULL;
|
|
|
|
return NGX_OK;
|
|
|
|
}
|
|
|
|
|
2004-12-03 02:40:46 +08:00
|
|
|
if (n == 0) {
|
|
|
|
again = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2004-07-16 14:33:35 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!again) {
|
2004-07-19 03:11:20 +08:00
|
|
|
sslerr = SSL_get_error(c->ssl->ssl, n);
|
2004-07-16 14:33:35 +08:00
|
|
|
|
2004-07-19 03:11:20 +08:00
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0,
|
|
|
|
"SSL_get_error: %d", sslerr);
|
2004-07-16 14:33:35 +08:00
|
|
|
}
|
|
|
|
|
2004-07-19 03:11:20 +08:00
|
|
|
if (again || sslerr == SSL_ERROR_WANT_READ) {
|
2004-07-16 14:33:35 +08:00
|
|
|
|
2004-12-03 02:40:46 +08:00
|
|
|
ngx_add_timer(c->read, 30000);
|
2004-07-16 14:33:35 +08:00
|
|
|
|
|
|
|
if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NGX_AGAIN;
|
|
|
|
}
|
|
|
|
|
2004-07-19 03:11:20 +08:00
|
|
|
if (sslerr == SSL_ERROR_WANT_WRITE) {
|
2004-07-16 14:33:35 +08:00
|
|
|
|
|
|
|
if (ngx_handle_write_event(c->write, 0) == NGX_ERROR) {
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NGX_AGAIN;
|
|
|
|
}
|
|
|
|
|
2004-07-17 01:11:43 +08:00
|
|
|
ngx_ssl_error(NGX_LOG_ALERT, c->log, 0, "SSL_shutdown() failed");
|
2004-07-16 00:35:51 +08:00
|
|
|
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-02-16 21:40:36 +08:00
|
|
|
void
|
|
|
|
ngx_ssl_error(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, char *fmt, ...)
|
2004-07-16 00:35:51 +08:00
|
|
|
{
|
2004-11-11 22:07:14 +08:00
|
|
|
u_char errstr[NGX_MAX_CONF_ERRSTR], *p, *last;
|
|
|
|
va_list args;
|
|
|
|
|
|
|
|
last = errstr + NGX_MAX_CONF_ERRSTR;
|
2004-07-16 00:35:51 +08:00
|
|
|
|
|
|
|
va_start(args, fmt);
|
2004-11-11 22:07:14 +08:00
|
|
|
p = ngx_vsnprintf(errstr, sizeof(errstr) - 1, fmt, args);
|
2004-07-16 00:35:51 +08:00
|
|
|
va_end(args);
|
|
|
|
|
2005-03-19 20:38:37 +08:00
|
|
|
p = ngx_cpystrn(p, (u_char *) " (SSL: ", last - p);
|
2004-07-16 00:35:51 +08:00
|
|
|
|
2004-11-11 22:07:14 +08:00
|
|
|
ERR_error_string_n(ERR_get_error(), (char *) p, last - p);
|
2004-07-16 00:35:51 +08:00
|
|
|
|
2004-07-17 01:11:43 +08:00
|
|
|
ngx_log_error(level, log, err, "%s)", errstr);
|
2004-07-16 00:35:51 +08:00
|
|
|
}
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 22:58:06 +08:00
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
ngx_ssl_cleanup_ctx(void *data)
|
|
|
|
{
|
|
|
|
SSL_CTX *ctx = data;
|
|
|
|
|
|
|
|
SSL_CTX_free(ctx);
|
|
|
|
}
|