comparison src/http/ngx_http_upstream.c @ 56:3050baa54a26 NGINX_0_1_28

nginx 0.1.28 *) Bugfix: nginx hogs CPU while proxying the huge files. *) Bugfix: nginx could not be built by gcc 4.0 on Linux.
author Igor Sysoev <http://sysoev.ru>
date Fri, 08 Apr 2005 00:00:00 +0400
parents bcb5fce0b038
children b55cbf18157e
comparison
equal deleted inserted replaced
55:729de7d75018 56:3050baa54a26
1133 1133
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 uintptr_t escape;
1139 ngx_http_log_ctx_t *ctx; 1139 ngx_http_log_ctx_t *ctx;
1140 ngx_http_request_t *r; 1140 ngx_http_request_t *r;
1141 ngx_http_upstream_t *u; 1141 ngx_http_upstream_t *u;
1142 ngx_peer_connection_t *peer; 1142 ngx_peer_connection_t *peer;
1143 1143
1151 " upstream: %V%V%s%V", 1151 " upstream: %V%V%s%V",
1152 log->action, 1152 log->action,
1153 &r->connection->addr_text, 1153 &r->connection->addr_text,
1154 &r->server_name, 1154 &r->server_name,
1155 &r->unparsed_uri, 1155 &r->unparsed_uri,
1156 &u->schema, 1156 &u->schema0,
1157 &peer->peers->peer[peer->cur_peer].name, 1157 &peer->peers->peer[peer->cur_peer].name,
1158 peer->peers->peer[peer->cur_peer].uri_separator, 1158 peer->peers->peer[peer->cur_peer].uri_separator,
1159 &u->uri); 1159 &u->uri0);
1160 len -= p - buf; 1160 len -= p - buf;
1161 buf = p; 1161 buf = p;
1162 1162
1163 if (r->quoted_uri) { 1163 if (r->quoted_uri) {
1164 escape = 2 * ngx_escape_uri(NULL, r->uri.data + u->location->len, 1164 escape = 2 * ngx_escape_uri(NULL, r->uri.data + u->location0->len,
1165 r->uri.len - u->location->len, 1165 r->uri.len - u->location0->len,
1166 NGX_ESCAPE_URI); 1166 NGX_ESCAPE_URI);
1167 } else { 1167 } else {
1168 escape = 0; 1168 escape = 0;
1169 } 1169 }
1170 1170
1171 if (escape) { 1171 if (escape) {
1172 if (len >= r->uri.len - u->location->len + escape) { 1172 if (len >= r->uri.len - u->location0->len + escape) {
1173 1173
1174 ngx_escape_uri(buf, r->uri.data + u->location->len, 1174 ngx_escape_uri(buf, r->uri.data + u->location0->len,
1175 r->uri.len - u->location->len, NGX_ESCAPE_URI); 1175 r->uri.len - u->location0->len, NGX_ESCAPE_URI);
1176 1176
1177 buf += r->uri.len - u->location->len + escape; 1177 buf += r->uri.len - u->location0->len + escape;
1178 len -= r->uri.len - u->location->len + escape; 1178 len -= r->uri.len - u->location0->len + escape;
1179 1179
1180 if (r->args.len) { 1180 if (r->args.len) {
1181 p = ngx_snprintf(buf, len, "?%V", &r->args); 1181 p = ngx_snprintf(buf, len, "?%V", &r->args);
1182 len -= p - buf; 1182 len -= p - buf;
1183 buf = p; 1183 buf = p;
1184 } 1184 }
1185 1185
1186 return ngx_http_log_error_info(r, buf, len); 1186 return ngx_http_log_error_info(r, buf, len);
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->location0->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->location0->len,
1195 r->uri.len - u->location->len, NGX_ESCAPE_URI); 1195 r->uri.len - u->location0->len, NGX_ESCAPE_URI);
1196 1196
1197 p = ngx_cpymem(buf, p, r->uri.len - u->location->len + escape); 1197 p = ngx_cpymem(buf, p, r->uri.len - u->location0->len + escape);
1198 1198
1199 } else { 1199 } else {
1200 p = ngx_cpymem(buf, r->uri.data + u->location->len, 1200 p = ngx_cpymem(buf, r->uri.data + u->location0->len,
1201 r->uri.len - u->location->len); 1201 r->uri.len - u->location0->len);
1202 } 1202 }
1203 1203
1204 len -= p - buf; 1204 len -= p - buf;
1205 buf = p; 1205 buf = p;
1206 1206