return NGX_ERROR;
}
- if (ngx_strncasecmp(proxy.data, (u_char *) "http://", 7) == 0) {
-
+ if (proxy.len > 7
+ && ngx_strncasecmp(proxy.data, (u_char *) "http://", 7) == 0)
+ {
add = 7;
port = 80;
#if (NGX_HTTP_SSL)
- } else if (ngx_strncasecmp(proxy.data, (u_char *) "https://", 8) == 0) {
-
+ } else if (proxy.len > 8
+ && ngx_strncasecmp(proxy.data, (u_char *) "https://", 8) == 0)
+ {
add = 8;
port = 443;
r->upstream->ssl = 1;
conf->headers_hash_max_size = NGX_CONF_UNSET_UINT;
conf->headers_hash_bucket_size = NGX_CONF_UNSET_UINT;
+ ngx_str_set(&conf->upstream.module, "proxy");
+
return conf;
}
ngx_http_file_cache_create_key(r);
- if (r->cache->header_start >= u->conf->buffer_size) {
+ if (r->cache->header_start + 256 >= u->conf->buffer_size) {
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- "cache key too large, increase upstream buffer size %uz",
- u->conf->buffer_size);
+ "%V_buffer_size %uz is not enough for cache key, "
+ "it should increased at least to %uz",
+ &u->conf->module, u->conf->buffer_size,
+ ngx_align(r->cache->header_start + 256, 1024));
r->cache = NULL;
return NGX_DECLINED;
if (wev->timedout) {
c->timedout = 1;
ngx_connection_error(c, NGX_ETIMEDOUT, "client timed out");
- ngx_http_upstream_finalize_request(r, u, 0);
+ ngx_http_upstream_finalize_request(r, u, NGX_HTTP_REQUEST_TIME_OUT);
return;
}
#endif
if (u->header_sent
+ && rc != NGX_HTTP_REQUEST_TIME_OUT
&& (rc == NGX_ERROR || rc >= NGX_HTTP_SPECIAL_RESPONSE))
{
rc = 0;