comparison src/http/ngx_http_upstream.c @ 54:bcb5fce0b038 NGINX_0_1_27

nginx 0.1.27 *) Feature: the "blocked" parameter of the "valid_referers" directive. *) Change: the errors while handling the request header now logged at "info" level. The server name and the "Host" and "Referer" header lines also logged. *) Change: the "Host" header line is also logged in error log. *) Feature: the proxy_pass_unparsed_uri directive. The special handling of the "://" symbols in URI, appeared in 0.1.11 version, now is canceled. *) Bugfix: nginx could not be built on FreeBSD and Linux, if the --without-ngx_http_auth_basic_module configuration parameter was used.
author Igor Sysoev <http://sysoev.ru>
date Mon, 28 Mar 2005 00:00:00 +0400
parents 0d75d65c642f
children 3050baa54a26
comparison
equal deleted inserted replaced
53:b6565ddf033b 54:bcb5fce0b038
1134 u_char * 1134 u_char *
1135 ngx_http_upstream_log_error(ngx_log_t *log, u_char *buf, size_t len) 1135 ngx_http_upstream_log_error(ngx_log_t *log, u_char *buf, size_t len)
1136 { 1136 {
1137 u_char *p; 1137 u_char *p;
1138 ngx_int_t escape; 1138 ngx_int_t escape;
1139 ngx_str_t uri;
1140 ngx_http_log_ctx_t *ctx; 1139 ngx_http_log_ctx_t *ctx;
1141 ngx_http_request_t *r; 1140 ngx_http_request_t *r;
1142 ngx_http_upstream_t *u; 1141 ngx_http_upstream_t *u;
1143 ngx_peer_connection_t *peer; 1142 ngx_peer_connection_t *peer;
1144 1143
1146 r = ctx->request; 1145 r = ctx->request;
1147 u = r->upstream; 1146 u = r->upstream;
1148 peer = &u->peer; 1147 peer = &u->peer;
1149 1148
1150 p = ngx_snprintf(buf, len, 1149 p = ngx_snprintf(buf, len,
1151 " while %s, client: %V, host: %V, URL: \"%V\"," 1150 " while %s, client: %V, server: %V, URL: \"%V\","
1152 " upstream: %V%V%s%V", 1151 " upstream: %V%V%s%V",
1153 log->action, 1152 log->action,
1154 &r->connection->addr_text, 1153 &r->connection->addr_text,
1155 &r->server_name, 1154 &r->server_name,
1156 &r->unparsed_uri, 1155 &r->unparsed_uri,
1174 1173
1175 ngx_escape_uri(buf, r->uri.data + u->location->len, 1174 ngx_escape_uri(buf, r->uri.data + u->location->len,
1176 r->uri.len - u->location->len, NGX_ESCAPE_URI); 1175 r->uri.len - u->location->len, NGX_ESCAPE_URI);
1177 1176
1178 buf += r->uri.len - u->location->len + escape; 1177 buf += r->uri.len - u->location->len + escape;
1179 1178 len -= r->uri.len - u->location->len + escape;
1180 if (r->args.len == 0) { 1179
1181 return buf; 1180 if (r->args.len) {
1181 p = ngx_snprintf(buf, len, "?%V", &r->args);
1182 len -= p - buf;
1183 buf = p;
1182 } 1184 }
1183 1185
1184 len -= r->uri.len - u->location->len + escape; 1186 return ngx_http_log_error_info(r, buf, len);
1185
1186 return ngx_snprintf(buf, len, "?%V", &r->args);
1187 } 1187 }
1188 1188
1189 p = ngx_palloc(r->pool, r->uri.len - u->location->len + escape); 1189 p = ngx_palloc(r->pool, r->uri.len - u->location->len + escape);
1190 if (p == NULL) { 1190 if (p == NULL) {
1191 return buf; 1191 return buf;
1192 } 1192 }
1193 1193
1194 ngx_escape_uri(p, r->uri.data + u->location->len, 1194 ngx_escape_uri(p, r->uri.data + u->location->len,
1195 r->uri.len - u->location->len, NGX_ESCAPE_URI); 1195 r->uri.len - u->location->len, NGX_ESCAPE_URI);
1196 1196
1197 uri.len = r->uri.len - u->location->len + escape; 1197 p = ngx_cpymem(buf, p, r->uri.len - u->location->len + escape);
1198 uri.data = p;
1199 1198
1200 } else { 1199 } else {
1201 uri.len = r->uri.len - u->location->len; 1200 p = ngx_cpymem(buf, r->uri.data + u->location->len,
1202 uri.data = r->uri.data + u->location->len; 1201 r->uri.len - u->location->len);
1203 1202 }
1204 } 1203
1205 1204 len -= p - buf;
1206 return ngx_snprintf(buf, len, "%V%s%V", 1205 buf = p;
1207 &uri, r->args.len ? "?" : "", &r->args); 1206
1207 if (r->args.len) {
1208 p = ngx_snprintf(buf, len, "?%V", &r->args);
1209 len -= p - buf;
1210 buf = p;
1211 }
1212
1213 return ngx_http_log_error_info(r, buf, len);
1208 } 1214 }
1209 1215
1210 1216
1211 static ngx_int_t 1217 static ngx_int_t
1212 ngx_http_upstream_add_log_formats(ngx_conf_t *cf) 1218 ngx_http_upstream_add_log_formats(ngx_conf_t *cf)