comparison src/event/ngx_event.c @ 214:0ad9eeb6ac7f NGINX_0_3_54

nginx 0.3.54 *) Feature: nginx now logs the subrequest information to the error log. *) Feature: the "proxy_next_upstream", "fastcgi_next_upstream", and "memcached_next_upstream" directives support the "off" parameter. *) Feature: the "debug_connection" directive supports the CIDR address form. *) Bugfix: if a response of proxied server or FastCGI server was converted from UTF-8 or back, then it may be transferred incomplete. *) Bugfix: the $upstream_response_time variable had the time of the first request to a backend only. *) Bugfix: nginx could not be built on amd64 platform; bug appeared in 0.3.53.
author Igor Sysoev <http://sysoev.ru>
date Tue, 11 Jul 2006 00:00:00 +0400
parents 56688ed172c8
children fa32d59d9a15
comparison
equal deleted inserted replaced
213:405beeeadf7f 214:0ad9eeb6ac7f
1033 ngx_event_debug_connection(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 1033 ngx_event_debug_connection(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1034 { 1034 {
1035 #if (NGX_DEBUG) 1035 #if (NGX_DEBUG)
1036 ngx_event_conf_t *ecf = conf; 1036 ngx_event_conf_t *ecf = conf;
1037 1037
1038 in_addr_t *addr; 1038 ngx_event_debug_t *dc;
1039 ngx_str_t *value; 1039 ngx_str_t *value;
1040 struct hostent *h; 1040 struct hostent *h;
1041 ngx_inet_cidr_t in_cidr;
1041 1042
1042 value = cf->args->elts; 1043 value = cf->args->elts;
1043 1044
1044 /* AF_INET only */ 1045 /* AF_INET only */
1045 1046
1046 addr = ngx_array_push(&ecf->debug_connection); 1047 dc = ngx_array_push(&ecf->debug_connection);
1047 if (addr == NULL) { 1048 if (dc == NULL) {
1048 return NGX_CONF_ERROR; 1049 return NGX_CONF_ERROR;
1049 } 1050 }
1050 1051
1051 *addr = inet_addr((char *) value[1].data); 1052 dc->addr = inet_addr((char *) value[1].data);
1052 1053
1053 if (*addr != INADDR_NONE) { 1054 if (dc->addr != INADDR_NONE) {
1055 dc->mask = 0xffffffff;
1056 return NGX_OK;
1057 }
1058
1059 if (ngx_ptocidr(&value[1], &in_cidr) == NGX_OK) {
1060 dc->mask = in_cidr.mask;
1061 dc->addr = in_cidr.addr;
1054 return NGX_OK; 1062 return NGX_OK;
1055 } 1063 }
1056 1064
1057 h = gethostbyname((char *) value[1].data); 1065 h = gethostbyname((char *) value[1].data);
1058 1066
1060 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 1068 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
1061 "host \"%s\" not found", value[1].data); 1069 "host \"%s\" not found", value[1].data);
1062 return NGX_CONF_ERROR; 1070 return NGX_CONF_ERROR;
1063 } 1071 }
1064 1072
1065 *addr = *(in_addr_t *)(h->h_addr_list[0]); 1073 dc->mask = 0xffffffff;
1074 dc->addr = *(in_addr_t *)(h->h_addr_list[0]);
1066 1075
1067 #else 1076 #else
1068 1077
1069 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, 1078 ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
1070 "\"debug_connection\" is ignored, you need to rebuild " 1079 "\"debug_connection\" is ignored, you need to rebuild "
1094 ecf->name = (void *) NGX_CONF_UNSET; 1103 ecf->name = (void *) NGX_CONF_UNSET;
1095 1104
1096 #if (NGX_DEBUG) 1105 #if (NGX_DEBUG)
1097 1106
1098 if (ngx_array_init(&ecf->debug_connection, cycle->pool, 4, 1107 if (ngx_array_init(&ecf->debug_connection, cycle->pool, 4,
1099 sizeof(in_addr_t)) == NGX_ERROR) 1108 sizeof(ngx_event_debug_t)) == NGX_ERROR)
1100 { 1109 {
1101 return NGX_CONF_ERROR; 1110 return NGX_CONF_ERROR;
1102 } 1111 }
1103 1112
1104 #endif 1113 #endif