mirror of
https://github.com/nginx/nginx.git
synced 2025-06-08 02:02:38 +08:00
nginx-0.1.37-RELEASE import
*) Change: now the "\n" is added to the end of the "nginx.pid" file. *) Bugfix: the responses may be transferred not completely, if many parts or the big parts were included by SSI. *) Bugfix: if all backends had returned the 404 reponse and the "http_404" parameter of the "proxy_next_upstream" or "fastcgi_next_upstream" directives was used, then nginx started to request all backends again.
This commit is contained in:
parent
2e87bb645a
commit
85ef94ba85
@ -9,6 +9,44 @@
|
|||||||
<title lang="en">nginx changelog</title>
|
<title lang="en">nginx changelog</title>
|
||||||
|
|
||||||
|
|
||||||
|
<changes ver="0.1.37" date="23.06.2005">
|
||||||
|
|
||||||
|
<change type="change">
|
||||||
|
<para lang="ru">
|
||||||
|
× ËÏÎÃÅ ÆÁÊÌÁ nginx.pid ÔÅÐÅÒØ ÄÏÂÁ×ÌÑÅÔÓÑ "\n".
|
||||||
|
</para>
|
||||||
|
<para lang="en">
|
||||||
|
now the "\n" is added to the end of the "nginx.pid" file.
|
||||||
|
</para>
|
||||||
|
</change>
|
||||||
|
|
||||||
|
<change type="bugfix">
|
||||||
|
<para lang="ru">
|
||||||
|
ÐÒÉ ×ËÌÀÞÅÎÉÉ ÂÏÌØÛÏÇÏ ËÏÌÉÞÅÓÔ×Á ×ÓÔÁ×ÏË ÉÌÉ ÎÅÓËÏÌØËÉÈ ÂÏÌØÛÉÈ ×ÓÔÁ×ÏË
|
||||||
|
Ó ÐÏÍÏÝØÀ SSI ÏÔ×ÅÔ ÍÏÇ ÐÅÒÅÄÁ×ÁÔØÓÑ ÎÅ ÐÏÌÎÏÓÔØÀ.
|
||||||
|
</para>
|
||||||
|
<para lang="en">
|
||||||
|
the responses may be transferred not completely,
|
||||||
|
if many parts or the big parts were included by SSI.
|
||||||
|
</para>
|
||||||
|
</change>
|
||||||
|
|
||||||
|
<change type="bugfix">
|
||||||
|
<para lang="ru">
|
||||||
|
ÅÓÌÉ ×ÓÅ ÂÜËÅÎÄÙ ×ÏÚ×ÒÁÝÁÌÉ ÏÔ×ÅÔ 404, ÔÏ ÐÒÉ ÉÓÐÏÌØÚÏ×ÁÎÉÉ ÐÁÒÁÍÅÔÒÁ http_404
|
||||||
|
× ÄÉÒÅËÔÉ×ÁÈ proxy_next_upstream ÉÌÉ fastcgi_next_upstream, nginx
|
||||||
|
ÎÁÞÉÎÁÌ ÚÁÐÒÁÛÉ×ÁÔØ ×ÓÅ ÂÜËÅÎÄÙ ÓÎÏ×Á.
|
||||||
|
</para>
|
||||||
|
<para lang="en">
|
||||||
|
if all backends had returned the 404 reponse and the "http_404" parameter of
|
||||||
|
the "proxy_next_upstream" or "fastcgi_next_upstream" directives was used,
|
||||||
|
then nginx started to request all backends again.
|
||||||
|
</para>
|
||||||
|
</change>
|
||||||
|
|
||||||
|
</changes>
|
||||||
|
|
||||||
|
|
||||||
<changes ver="0.1.36" date="15.06.2005">
|
<changes ver="0.1.36" date="15.06.2005">
|
||||||
|
|
||||||
<change type="change">
|
<change type="change">
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#define _NGINX_H_INCLUDED_
|
#define _NGINX_H_INCLUDED_
|
||||||
|
|
||||||
|
|
||||||
#define NGINX_VER "nginx/0.1.36"
|
#define NGINX_VER "nginx/0.1.37"
|
||||||
|
|
||||||
#define NGINX_VAR "NGINX"
|
#define NGINX_VAR "NGINX"
|
||||||
#define NGX_NEWPID_EXT ".newbin"
|
#define NGX_NEWPID_EXT ".newbin"
|
||||||
|
@ -744,7 +744,7 @@ ngx_int_t ngx_create_pidfile(ngx_cycle_t *cycle, ngx_cycle_t *old_cycle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!ngx_test_config) {
|
if (!ngx_test_config) {
|
||||||
len = ngx_sprintf(pid, "%P", ngx_pid) - pid;
|
len = ngx_sprintf(pid, "%P%N", ngx_pid) - pid;
|
||||||
|
|
||||||
if (ngx_write_file(&file, pid, len, 0) == NGX_ERROR) {
|
if (ngx_write_file(&file, pid, len, 0) == NGX_ERROR) {
|
||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
|
@ -62,6 +62,7 @@ ngx_pstrdup(ngx_pool_t *pool, ngx_str_t *src)
|
|||||||
* %V pointer to ngx_str_t
|
* %V pointer to ngx_str_t
|
||||||
* %s null-terminated string
|
* %s null-terminated string
|
||||||
* %Z '\0'
|
* %Z '\0'
|
||||||
|
* %N '\n'
|
||||||
* %c char
|
* %c char
|
||||||
* %% %
|
* %% %
|
||||||
*
|
*
|
||||||
@ -315,6 +316,15 @@ ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
|
|||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
case 'N':
|
||||||
|
#if (NGX_WIN32)
|
||||||
|
*buf++ = CR;
|
||||||
|
#endif
|
||||||
|
*buf++ = LF;
|
||||||
|
fmt++;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
|
||||||
case '%':
|
case '%':
|
||||||
*buf++ = '%';
|
*buf++ = '%';
|
||||||
fmt++;
|
fmt++;
|
||||||
|
@ -376,10 +376,11 @@ ngx_event_connect_peer(ngx_peer_connection_t *pc)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ngx_event_connect_peer_failed(ngx_peer_connection_t *pc)
|
ngx_event_connect_peer_failed(ngx_peer_connection_t *pc, ngx_uint_t down)
|
||||||
{
|
{
|
||||||
time_t now;
|
time_t now;
|
||||||
|
|
||||||
|
if (down) {
|
||||||
now = ngx_time();
|
now = ngx_time();
|
||||||
|
|
||||||
/* ngx_lock_mutex(pc->peers->mutex); */
|
/* ngx_lock_mutex(pc->peers->mutex); */
|
||||||
@ -388,6 +389,7 @@ ngx_event_connect_peer_failed(ngx_peer_connection_t *pc)
|
|||||||
pc->peers->peer[pc->cur_peer].accessed = now;
|
pc->peers->peer[pc->cur_peer].accessed = now;
|
||||||
|
|
||||||
/* ngx_unlock_mutex(pc->peers->mutex); */
|
/* ngx_unlock_mutex(pc->peers->mutex); */
|
||||||
|
}
|
||||||
|
|
||||||
pc->cur_peer++;
|
pc->cur_peer++;
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ typedef struct {
|
|||||||
|
|
||||||
|
|
||||||
ngx_int_t ngx_event_connect_peer(ngx_peer_connection_t *pc);
|
ngx_int_t ngx_event_connect_peer(ngx_peer_connection_t *pc);
|
||||||
void ngx_event_connect_peer_failed(ngx_peer_connection_t *pc);
|
void ngx_event_connect_peer_failed(ngx_peer_connection_t *pc, ngx_uint_t down);
|
||||||
|
|
||||||
|
|
||||||
#endif /* _NGX_EVENT_CONNECT_H_INCLUDED_ */
|
#endif /* _NGX_EVENT_CONNECT_H_INCLUDED_ */
|
||||||
|
@ -24,6 +24,7 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
ngx_str_t name;
|
ngx_str_t name;
|
||||||
|
size_t utf_len;
|
||||||
ngx_uint_t escape;
|
ngx_uint_t escape;
|
||||||
ngx_uint_t dir;
|
ngx_uint_t dir;
|
||||||
time_t mtime;
|
time_t mtime;
|
||||||
@ -304,6 +305,7 @@ ngx_http_autoindex_handler(ngx_http_request_t *r)
|
|||||||
}
|
}
|
||||||
|
|
||||||
entry->name.len = len;
|
entry->name.len = len;
|
||||||
|
|
||||||
entry->escape = 2 * ngx_escape_uri(NULL, ngx_de_name(&dir), len,
|
entry->escape = 2 * ngx_escape_uri(NULL, ngx_de_name(&dir), len,
|
||||||
NGX_ESCAPE_HTML);
|
NGX_ESCAPE_HTML);
|
||||||
|
|
||||||
@ -314,6 +316,12 @@ ngx_http_autoindex_handler(ngx_http_request_t *r)
|
|||||||
|
|
||||||
ngx_cpystrn(entry->name.data, ngx_de_name(&dir), len + 1);
|
ngx_cpystrn(entry->name.data, ngx_de_name(&dir), len + 1);
|
||||||
|
|
||||||
|
if (r->utf8) {
|
||||||
|
entry->utf_len = ngx_utf_length(&entry->name);
|
||||||
|
} else {
|
||||||
|
entry->utf_len = len;
|
||||||
|
}
|
||||||
|
|
||||||
entry->dir = ngx_de_is_dir(&dir);
|
entry->dir = ngx_de_is_dir(&dir);
|
||||||
entry->mtime = ngx_de_mtime(&dir);
|
entry->mtime = ngx_de_mtime(&dir);
|
||||||
entry->size = ngx_de_size(&dir);
|
entry->size = ngx_de_size(&dir);
|
||||||
@ -339,15 +347,12 @@ ngx_http_autoindex_handler(ngx_http_request_t *r)
|
|||||||
+ 1 /* 1 is for "/" */
|
+ 1 /* 1 is for "/" */
|
||||||
+ entry[i].name.len + entry[i].escape
|
+ entry[i].name.len + entry[i].escape
|
||||||
+ sizeof("\">") - 1
|
+ sizeof("\">") - 1
|
||||||
|
+ entry[i].name.len - entry[i].utf_len
|
||||||
+ NGX_HTTP_AUTOINDEX_NAME_LEN + sizeof(">") - 2
|
+ NGX_HTTP_AUTOINDEX_NAME_LEN + sizeof(">") - 2
|
||||||
+ sizeof("</a>") - 1
|
+ sizeof("</a>") - 1
|
||||||
+ sizeof(" 28-Sep-1970 12:00 ") - 1
|
+ sizeof(" 28-Sep-1970 12:00 ") - 1
|
||||||
+ 19
|
+ 19
|
||||||
+ 2;
|
+ 2;
|
||||||
|
|
||||||
if (r->utf8) {
|
|
||||||
len += entry[i].name.len - ngx_utf_length(&entry[i].name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
b = ngx_create_temp_buf(r->pool, len);
|
b = ngx_create_temp_buf(r->pool, len);
|
||||||
@ -394,11 +399,7 @@ ngx_http_autoindex_handler(ngx_http_request_t *r)
|
|||||||
b->last = ngx_cpystrn(b->last, entry[i].name.data,
|
b->last = ngx_cpystrn(b->last, entry[i].name.data,
|
||||||
NGX_HTTP_AUTOINDEX_NAME_LEN + 1);
|
NGX_HTTP_AUTOINDEX_NAME_LEN + 1);
|
||||||
|
|
||||||
if (r->utf8) {
|
len = entry[i].utf_len;
|
||||||
len = ngx_utf_length(&entry[i].name);
|
|
||||||
} else {
|
|
||||||
len = entry[i].name.len;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (len > NGX_HTTP_AUTOINDEX_NAME_LEN) {
|
if (len > NGX_HTTP_AUTOINDEX_NAME_LEN) {
|
||||||
b->last = ngx_cpymem(b->last - 3, "..></a>",
|
b->last = ngx_cpymem(b->last - 3, "..></a>",
|
||||||
|
@ -34,7 +34,6 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
ngx_flag_t enable;
|
ngx_flag_t enable;
|
||||||
ngx_flag_t autodetect;
|
|
||||||
|
|
||||||
ngx_int_t default_charset;
|
ngx_int_t default_charset;
|
||||||
ngx_int_t source_charset;
|
ngx_int_t source_charset;
|
||||||
@ -96,13 +95,6 @@ static ngx_command_t ngx_http_charset_filter_commands[] = {
|
|||||||
offsetof(ngx_http_charset_loc_conf_t, enable),
|
offsetof(ngx_http_charset_loc_conf_t, enable),
|
||||||
NULL },
|
NULL },
|
||||||
|
|
||||||
{ ngx_string("autodetect_charset"),
|
|
||||||
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
|
|
||||||
ngx_conf_set_flag_slot,
|
|
||||||
NGX_HTTP_LOC_CONF_OFFSET,
|
|
||||||
offsetof(ngx_http_charset_loc_conf_t, autodetect),
|
|
||||||
NULL },
|
|
||||||
|
|
||||||
ngx_null_command
|
ngx_null_command
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -570,7 +562,6 @@ ngx_http_charset_create_loc_conf(ngx_conf_t *cf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
lcf->enable = NGX_CONF_UNSET;
|
lcf->enable = NGX_CONF_UNSET;
|
||||||
lcf->autodetect = NGX_CONF_UNSET;
|
|
||||||
lcf->default_charset = NGX_CONF_UNSET;
|
lcf->default_charset = NGX_CONF_UNSET;
|
||||||
lcf->source_charset = NGX_CONF_UNSET;
|
lcf->source_charset = NGX_CONF_UNSET;
|
||||||
|
|
||||||
@ -585,8 +576,6 @@ ngx_http_charset_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||||||
ngx_http_charset_loc_conf_t *conf = child;
|
ngx_http_charset_loc_conf_t *conf = child;
|
||||||
|
|
||||||
ngx_conf_merge_value(conf->enable, prev->enable, 0);
|
ngx_conf_merge_value(conf->enable, prev->enable, 0);
|
||||||
ngx_conf_merge_value(conf->autodetect, prev->autodetect, 0);
|
|
||||||
|
|
||||||
|
|
||||||
if (conf->default_charset == NGX_CONF_UNSET) {
|
if (conf->default_charset == NGX_CONF_UNSET) {
|
||||||
conf->default_charset = prev->default_charset;
|
conf->default_charset = prev->default_charset;
|
||||||
|
@ -31,7 +31,7 @@ static ngx_int_t ngx_http_process_request_header(ngx_http_request_t *r);
|
|||||||
static ngx_int_t ngx_http_find_virtual_server(ngx_http_request_t *r);
|
static ngx_int_t ngx_http_find_virtual_server(ngx_http_request_t *r);
|
||||||
|
|
||||||
static void ngx_http_request_handler(ngx_event_t *ev);
|
static void ngx_http_request_handler(ngx_event_t *ev);
|
||||||
static void ngx_http_set_write_handler(ngx_http_request_t *r);
|
static ngx_int_t ngx_http_set_write_handler(ngx_http_request_t *r);
|
||||||
static void ngx_http_writer(ngx_http_request_t *r);
|
static void ngx_http_writer(ngx_http_request_t *r);
|
||||||
static ngx_int_t ngx_http_postponed_handler(ngx_http_request_t *r);
|
static ngx_int_t ngx_http_postponed_handler(ngx_http_request_t *r);
|
||||||
|
|
||||||
@ -1433,7 +1433,9 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (r->parent || rc == NGX_AGAIN) {
|
if (r->parent || rc == NGX_AGAIN) {
|
||||||
r->write_event_handler = ngx_http_writer;
|
if (ngx_http_set_write_handler(r) != NGX_OK) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
r->done = 1;
|
r->done = 1;
|
||||||
@ -1497,7 +1499,7 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
} else if (rc == NGX_AGAIN || r->out) {
|
} else if (rc == NGX_AGAIN || r->out) {
|
||||||
ngx_http_set_write_handler(r);
|
(void) ngx_http_set_write_handler(r);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1541,7 +1543,7 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static ngx_int_t
|
||||||
ngx_http_set_write_handler(ngx_http_request_t *r)
|
ngx_http_set_write_handler(ngx_http_request_t *r)
|
||||||
{
|
{
|
||||||
ngx_event_t *wev;
|
ngx_event_t *wev;
|
||||||
@ -1549,10 +1551,12 @@ ngx_http_set_write_handler(ngx_http_request_t *r)
|
|||||||
|
|
||||||
r->http_state = NGX_HTTP_WRITING_REQUEST_STATE;
|
r->http_state = NGX_HTTP_WRITING_REQUEST_STATE;
|
||||||
|
|
||||||
|
r->write_event_handler = ngx_http_writer;
|
||||||
|
|
||||||
wev = r->connection->write;
|
wev = r->connection->write;
|
||||||
|
|
||||||
if (wev->ready && wev->delayed) {
|
if (wev->ready && wev->delayed) {
|
||||||
return;
|
return NGX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
|
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
|
||||||
@ -1563,7 +1567,10 @@ ngx_http_set_write_handler(ngx_http_request_t *r)
|
|||||||
if (ngx_handle_write_event(wev, clcf->send_lowat) == NGX_ERROR) {
|
if (ngx_handle_write_event(wev, clcf->send_lowat) == NGX_ERROR) {
|
||||||
ngx_http_close_request(r, 0);
|
ngx_http_close_request(r, 0);
|
||||||
ngx_http_close_connection(r->connection);
|
ngx_http_close_connection(r->connection);
|
||||||
|
return NGX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return NGX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1230,7 +1230,7 @@ static void
|
|||||||
ngx_http_upstream_next(ngx_http_request_t *r, ngx_http_upstream_t *u,
|
ngx_http_upstream_next(ngx_http_request_t *r, ngx_http_upstream_t *u,
|
||||||
ngx_uint_t ft_type)
|
ngx_uint_t ft_type)
|
||||||
{
|
{
|
||||||
ngx_uint_t status;
|
ngx_uint_t status, down;
|
||||||
|
|
||||||
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
||||||
"http next upstream, %xD", ft_type);
|
"http next upstream, %xD", ft_type);
|
||||||
@ -1239,10 +1239,14 @@ ngx_http_upstream_next(ngx_http_request_t *r, ngx_http_upstream_t *u,
|
|||||||
ngx_http_busy_unlock(u->conf->busy_lock, &u->busy_lock);
|
ngx_http_busy_unlock(u->conf->busy_lock, &u->busy_lock);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ft_type != NGX_HTTP_UPSTREAM_FT_HTTP_404) {
|
if (ft_type == NGX_HTTP_UPSTREAM_FT_HTTP_404) {
|
||||||
ngx_event_connect_peer_failed(&u->peer);
|
down = 0;
|
||||||
|
} else {
|
||||||
|
down = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngx_event_connect_peer_failed(&u->peer, down);
|
||||||
|
|
||||||
if (ft_type == NGX_HTTP_UPSTREAM_FT_TIMEOUT) {
|
if (ft_type == NGX_HTTP_UPSTREAM_FT_TIMEOUT) {
|
||||||
ngx_log_error(NGX_LOG_ERR, r->connection->log, NGX_ETIMEDOUT,
|
ngx_log_error(NGX_LOG_ERR, r->connection->log, NGX_ETIMEDOUT,
|
||||||
"upstream timed out");
|
"upstream timed out");
|
||||||
@ -1285,8 +1289,7 @@ ngx_http_upstream_next(ngx_http_request_t *r, ngx_http_upstream_t *u,
|
|||||||
if (status) {
|
if (status) {
|
||||||
u->state->status = status;
|
u->state->status = status;
|
||||||
|
|
||||||
if (u->peer.tries == 0 || !(u->conf->next_upstream & ft_type))
|
if (u->peer.tries == 0 || !(u->conf->next_upstream & ft_type)) {
|
||||||
{
|
|
||||||
|
|
||||||
#if (NGX_HTTP_CACHE)
|
#if (NGX_HTTP_CACHE)
|
||||||
|
|
||||||
|
@ -136,6 +136,7 @@ typedef struct {
|
|||||||
|
|
||||||
void ngx_imap_init_connection(ngx_connection_t *c);
|
void ngx_imap_init_connection(ngx_connection_t *c);
|
||||||
void ngx_imap_close_connection(ngx_connection_t *c);
|
void ngx_imap_close_connection(ngx_connection_t *c);
|
||||||
|
void ngx_imap_session_internal_server_error(ngx_imap_session_t *s);
|
||||||
|
|
||||||
ngx_int_t ngx_pop3_parse_command(ngx_imap_session_t *s);
|
ngx_int_t ngx_pop3_parse_command(ngx_imap_session_t *s);
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
ngx_buf_t *request;
|
ngx_buf_t *request;
|
||||||
|
ngx_buf_t *response;
|
||||||
ngx_peer_connection_t peer;
|
ngx_peer_connection_t peer;
|
||||||
} ngx_imap_auth_http_ctx_t;
|
} ngx_imap_auth_http_ctx_t;
|
||||||
|
|
||||||
@ -91,7 +92,7 @@ ngx_imap_auth_http_init(ngx_imap_session_t *s)
|
|||||||
|
|
||||||
ctx = ngx_pcalloc(s->connection->pool, sizeof(ngx_imap_auth_http_ctx_t));
|
ctx = ngx_pcalloc(s->connection->pool, sizeof(ngx_imap_auth_http_ctx_t));
|
||||||
if (ctx == NULL) {
|
if (ctx == NULL) {
|
||||||
ngx_imap_close_connection(s->connection);
|
ngx_imap_session_internal_server_error(s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,7 +100,7 @@ ngx_imap_auth_http_init(ngx_imap_session_t *s)
|
|||||||
|
|
||||||
ctx->request = ngx_imap_auth_http_create_request(s, ahcf);
|
ctx->request = ngx_imap_auth_http_create_request(s, ahcf);
|
||||||
if (ctx->request == NULL) {
|
if (ctx->request == NULL) {
|
||||||
ngx_imap_close_connection(s->connection);
|
ngx_imap_session_internal_server_error(s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,7 +113,7 @@ ngx_imap_auth_http_init(ngx_imap_session_t *s)
|
|||||||
rc = ngx_event_connect_peer(&ctx->peer);
|
rc = ngx_event_connect_peer(&ctx->peer);
|
||||||
|
|
||||||
if (rc == NGX_ERROR) {
|
if (rc == NGX_ERROR) {
|
||||||
ngx_imap_close_connection(s->connection);
|
ngx_imap_session_internal_server_error(s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,8 +154,8 @@ ngx_imap_auth_http_write_handler(ngx_event_t *wev)
|
|||||||
if (wev->timedout) {
|
if (wev->timedout) {
|
||||||
ngx_log_error(NGX_LOG_ERR, wev->log, NGX_ETIMEDOUT,
|
ngx_log_error(NGX_LOG_ERR, wev->log, NGX_ETIMEDOUT,
|
||||||
"auth http server timed out");
|
"auth http server timed out");
|
||||||
ngx_imap_close_connection(ctx->peer.connection);
|
ngx_close_connection(ctx->peer.connection);
|
||||||
ngx_imap_close_connection(s->connection);
|
ngx_imap_session_internal_server_error(s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,8 +164,8 @@ ngx_imap_auth_http_write_handler(ngx_event_t *wev)
|
|||||||
n = ngx_send(c, ctx->request->pos, size);
|
n = ngx_send(c, ctx->request->pos, size);
|
||||||
|
|
||||||
if (n == NGX_ERROR) {
|
if (n == NGX_ERROR) {
|
||||||
ngx_imap_close_connection(ctx->peer.connection);
|
ngx_close_connection(ctx->peer.connection);
|
||||||
ngx_imap_close_connection(s->connection);
|
ngx_imap_session_internal_server_error(s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,23 +193,52 @@ ngx_imap_auth_http_write_handler(ngx_event_t *wev)
|
|||||||
static void
|
static void
|
||||||
ngx_imap_auth_http_read_handler(ngx_event_t *rev)
|
ngx_imap_auth_http_read_handler(ngx_event_t *rev)
|
||||||
{
|
{
|
||||||
|
ssize_t n, size;
|
||||||
ngx_peers_t *peers;
|
ngx_peers_t *peers;
|
||||||
ngx_connection_t *c;
|
ngx_connection_t *c;
|
||||||
ngx_imap_session_t *s;
|
ngx_imap_session_t *s;
|
||||||
#if 0
|
|
||||||
ngx_imap_auth_http_ctx_t *ctx;
|
ngx_imap_auth_http_ctx_t *ctx;
|
||||||
#endif
|
|
||||||
|
|
||||||
c = rev->data;
|
c = rev->data;
|
||||||
s = c->data;
|
s = c->data;
|
||||||
|
|
||||||
#if 0
|
|
||||||
ctx = ngx_imap_get_module_ctx(s, ngx_imap_auth_http_module);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ngx_log_debug0(NGX_LOG_DEBUG_IMAP, rev->log, 0,
|
ngx_log_debug0(NGX_LOG_DEBUG_IMAP, rev->log, 0,
|
||||||
"imap auth http read handler");
|
"imap auth http read handler");
|
||||||
|
|
||||||
|
ctx = ngx_imap_get_module_ctx(s, ngx_imap_auth_http_module);
|
||||||
|
|
||||||
|
if (rev->timedout) {
|
||||||
|
ngx_log_error(NGX_LOG_ERR, rev->log, NGX_ETIMEDOUT,
|
||||||
|
"auth http server timed out");
|
||||||
|
ngx_close_connection(ctx->peer.connection);
|
||||||
|
ngx_imap_session_internal_server_error(s);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctx->response == NULL) {
|
||||||
|
ctx->response = ngx_create_temp_buf(s->connection->pool, 1024);
|
||||||
|
if (ctx->response == NULL) {
|
||||||
|
ngx_close_connection(ctx->peer.connection);
|
||||||
|
ngx_imap_session_internal_server_error(s);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
size = ctx->response->last - ctx->response->pos;
|
||||||
|
|
||||||
|
n = ngx_recv(c, ctx->response->pos, size);
|
||||||
|
|
||||||
|
if (n == NGX_ERROR || n == 0) {
|
||||||
|
ngx_close_connection(ctx->peer.connection);
|
||||||
|
ngx_imap_session_internal_server_error(s);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
peers = NULL;
|
peers = NULL;
|
||||||
|
|
||||||
ngx_imap_proxy_init(s, peers);
|
ngx_imap_proxy_init(s, peers);
|
||||||
@ -231,8 +261,8 @@ ngx_imap_auth_http_block_read(ngx_event_t *rev)
|
|||||||
|
|
||||||
ctx = ngx_imap_get_module_ctx(s, ngx_imap_auth_http_module);
|
ctx = ngx_imap_get_module_ctx(s, ngx_imap_auth_http_module);
|
||||||
|
|
||||||
ngx_imap_close_connection(ctx->peer.connection);
|
ngx_close_connection(ctx->peer.connection);
|
||||||
ngx_imap_close_connection(s->connection);
|
ngx_imap_session_internal_server_error(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,11 @@ static ngx_str_t greetings[] = {
|
|||||||
ngx_string("* OK " NGINX_VER " ready" CRLF)
|
ngx_string("* OK " NGINX_VER " ready" CRLF)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static ngx_str_t internal_server_errors[] = {
|
||||||
|
ngx_string("-ERR internal server error" CRLF),
|
||||||
|
ngx_string("* BAD internal server error" CRLF),
|
||||||
|
};
|
||||||
|
|
||||||
static u_char pop3_ok[] = "+OK" CRLF;
|
static u_char pop3_ok[] = "+OK" CRLF;
|
||||||
static u_char pop3_invalid_command[] = "-ERR invalid command" CRLF;
|
static u_char pop3_invalid_command[] = "-ERR invalid command" CRLF;
|
||||||
|
|
||||||
@ -341,6 +346,16 @@ ngx_imap_close_session(ngx_imap_session_t *s)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ngx_imap_session_internal_server_error(ngx_imap_session_t *s)
|
||||||
|
{
|
||||||
|
(void) ngx_send(s->connection, internal_server_errors[s->protocol].data,
|
||||||
|
internal_server_errors[s->protocol].len);
|
||||||
|
|
||||||
|
ngx_imap_close_connection(s->connection);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ngx_imap_close_connection(ngx_connection_t *c)
|
ngx_imap_close_connection(ngx_connection_t *c)
|
||||||
{
|
{
|
||||||
|
@ -285,7 +285,7 @@ ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_uint_t old,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#elif ( __ppc__ )
|
#elif ( __ppc__ || __powerpc__ )
|
||||||
|
|
||||||
#define NGX_HAVE_ATOMIC_OPS 1
|
#define NGX_HAVE_ATOMIC_OPS 1
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user