comparison src/imap/ngx_imap_auth_http_module.c @ 577:4d9ea73a627a release-0.3.10

nginx-0.3.10-RELEASE import *) Change: the "valid_referers" directive and the "$invalid_referer" variable were moved to the new ngx_http_referer_module from the ngx_http_rewrite_module. *) Change: the "$apache_bytes_sent" variable name was changed to "$body_bytes_sent". *) Feature: the "$sent_http_..." variables. *) Feature: the "if" directive supports the "=" and "!=" operations. *) Feature: the "proxy_pass" directive supports the HTTPS protocol. *) Feature: the "proxy_set_body" directive. *) Feature: the "post_action" directive. *) Feature: the ngx_http_empty_gif_module. *) Feature: the "worker_cpu_affinity" directive for Linux. *) Bugfix: the "rewrite" directive did not unescape URI part in redirect, now it is unescaped except the %00-%25 and %7F-%FF characters. *) Bugfix: nginx could not be built by the icc 9.0 compiler. *) Bugfix: if the SSI was enabled for zero size static file, then the chunked response was encoded incorrectly.
author Igor Sysoev <igor@sysoev.ru>
date Tue, 15 Nov 2005 13:30:52 +0000
parents 58475592100c
children 4e296b7d25bf
comparison
equal deleted inserted replaced
576:3e0b61c26426 577:4d9ea73a627a
215 ctx = ngx_imap_get_module_ctx(s, ngx_imap_auth_http_module); 215 ctx = ngx_imap_get_module_ctx(s, ngx_imap_auth_http_module);
216 216
217 ngx_log_debug0(NGX_LOG_DEBUG_IMAP, wev->log, 0, 217 ngx_log_debug0(NGX_LOG_DEBUG_IMAP, wev->log, 0,
218 "imap auth http write handler"); 218 "imap auth http write handler");
219 219
220 if (wev->timedout) { 220 if (wev->timedout) {
221 ngx_log_error(NGX_LOG_ERR, wev->log, NGX_ETIMEDOUT, 221 ngx_log_error(NGX_LOG_ERR, wev->log, NGX_ETIMEDOUT,
222 "auth http server %V timed out", 222 "auth http server %V timed out",
223 &ctx->peer.peers->peer[0].name); 223 &ctx->peer.peers->peer[0].name);
224 ngx_close_connection(ctx->peer.connection); 224 ngx_close_connection(ctx->peer.connection);
225 ngx_destroy_pool(ctx->pool); 225 ngx_destroy_pool(ctx->pool);
273 ngx_log_debug0(NGX_LOG_DEBUG_IMAP, rev->log, 0, 273 ngx_log_debug0(NGX_LOG_DEBUG_IMAP, rev->log, 0,
274 "imap auth http read handler"); 274 "imap auth http read handler");
275 275
276 ctx = ngx_imap_get_module_ctx(s, ngx_imap_auth_http_module); 276 ctx = ngx_imap_get_module_ctx(s, ngx_imap_auth_http_module);
277 277
278 if (rev->timedout) { 278 if (rev->timedout) {
279 ngx_log_error(NGX_LOG_ERR, rev->log, NGX_ETIMEDOUT, 279 ngx_log_error(NGX_LOG_ERR, rev->log, NGX_ETIMEDOUT,
280 "auth http server %V timed out", 280 "auth http server %V timed out",
281 &ctx->peer.peers->peer[0].name); 281 &ctx->peer.peers->peer[0].name);
282 ngx_close_connection(ctx->peer.connection); 282 ngx_close_connection(ctx->peer.connection);
283 ngx_destroy_pool(ctx->pool); 283 ngx_destroy_pool(ctx->pool);
382 switch (ch) { 382 switch (ch) {
383 case CR: 383 case CR:
384 state = sw_almost_done; 384 state = sw_almost_done;
385 385
386 break; 386 break;
387 case LF: 387 case LF:
388 goto done; 388 goto done;
389 } 389 }
390 break; 390 break;
391 391
392 /* end of status line */ 392 /* end of status line */
765 sw_start = 0, 765 sw_start = 0,
766 sw_name, 766 sw_name,
767 sw_space_before_value, 767 sw_space_before_value,
768 sw_value, 768 sw_value,
769 sw_space_after_value, 769 sw_space_after_value,
770 sw_almost_done, 770 sw_almost_done,
771 sw_header_almost_done 771 sw_header_almost_done
772 } state; 772 } state;
773 773
774 state = ctx->state; 774 state = ctx->state;
775 hash = ctx->hash; 775 hash = ctx->hash;
776 776
777 for (p = ctx->response->pos; p < ctx->response->last; p++) { 777 for (p = ctx->response->pos; p < ctx->response->last; p++) {
778 ch = *p; 778 ch = *p;
779 779
782 /* first char */ 782 /* first char */
783 case sw_start: 783 case sw_start:
784 784
785 switch (ch) { 785 switch (ch) {
786 case CR: 786 case CR:
787 ctx->header_end = p; 787 ctx->header_end = p;
788 state = sw_header_almost_done; 788 state = sw_header_almost_done;
789 break; 789 break;
790 case LF: 790 case LF:
791 ctx->header_end = p; 791 ctx->header_end = p;
792 goto header_done; 792 goto header_done;
793 default: 793 default:
794 state = sw_name; 794 state = sw_name;
795 ctx->header_name_start = p; 795 ctx->header_name_start = p;
1059 } 1059 }
1060 1060
1061 1061
1062 static void * 1062 static void *
1063 ngx_imap_auth_http_create_conf(ngx_conf_t *cf) 1063 ngx_imap_auth_http_create_conf(ngx_conf_t *cf)
1064 { 1064 {
1065 ngx_imap_auth_http_conf_t *ahcf; 1065 ngx_imap_auth_http_conf_t *ahcf;
1066 1066
1067 ahcf = ngx_pcalloc(cf->pool, sizeof(ngx_imap_auth_http_conf_t)); 1067 ahcf = ngx_pcalloc(cf->pool, sizeof(ngx_imap_auth_http_conf_t));
1068 if (ahcf == NULL) { 1068 if (ahcf == NULL) {
1069 return NGX_CONF_ERROR; 1069 return NGX_CONF_ERROR;
1070 } 1070 }
1071 1071
1126 } 1126 }
1127 1127
1128 1128
1129 static char * 1129 static char *
1130 ngx_imap_auth_http(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 1130 ngx_imap_auth_http(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1131 { 1131 {
1132 ngx_imap_auth_http_conf_t *ahcf = conf; 1132 ngx_imap_auth_http_conf_t *ahcf = conf;
1133 1133
1134 ngx_str_t *value, *url; 1134 ngx_str_t *value, *url;
1135 ngx_inet_upstream_t inet_upstream; 1135 ngx_inet_upstream_t inet_upstream;
1136 #if (NGX_HAVE_UNIX_DOMAIN) 1136 #if (NGX_HAVE_UNIX_DOMAIN)
1157 } 1157 }
1158 1158
1159 ahcf->host_header.len = sizeof("localhost") - 1; 1159 ahcf->host_header.len = sizeof("localhost") - 1;
1160 ahcf->host_header.data = (u_char *) "localhost"; 1160 ahcf->host_header.data = (u_char *) "localhost";
1161 ahcf->uri = unix_upstream.uri; 1161 ahcf->uri = unix_upstream.uri;
1162 1162
1163 #else 1163 #else
1164 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 1164 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
1165 "the unix domain sockets are not supported " 1165 "the unix domain sockets are not supported "
1166 "on this platform"); 1166 "on this platform");
1167 return NGX_CONF_ERROR; 1167 return NGX_CONF_ERROR;
1168 1168
1169 #endif 1169 #endif
1170 1170
1171 } else { 1171 } else {
1172 ngx_memzero(&inet_upstream, sizeof(ngx_inet_upstream_t)); 1172 ngx_memzero(&inet_upstream, sizeof(ngx_inet_upstream_t));
1173 1173
1194 } 1194 }
1195 1195
1196 1196
1197 static char * 1197 static char *
1198 ngx_imap_auth_http_header(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 1198 ngx_imap_auth_http_header(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1199 { 1199 {
1200 ngx_imap_auth_http_conf_t *ahcf = conf; 1200 ngx_imap_auth_http_conf_t *ahcf = conf;
1201 1201
1202 ngx_str_t *value; 1202 ngx_str_t *value;
1203 ngx_table_elt_t *header; 1203 ngx_table_elt_t *header;
1204 1204