annotate src/os/unix/ngx_sunpro_amd64.il @ 9295:c5623963c29e

Upstream: fixed proxy_no_cache when caching errors. Caching errors, notably intercepted errors and internally generated 502/504 errors, as well as handling of cache revalidation with 304, did not take into account u->conf->no_cache predicates configured. As a result, an error might be cached even if configuration explicitly says not to. Fix is to check u->conf->no_cache in these cases. To simplify usage in multiple places, checking u->conf->no_cache is now done in a separate function. As a minor optimization, u->conf->no_cache is only checked if u->cacheable is set. As a side effect, this change also fixes caching errors after proxy_cache_bypass. Also, during cache revalidation u->cacheable is now tested, so 304 responses which disable caching won't extend cacheability of stored responses. Additionally, when caching internally generated 502/504 errors u->cacheable is now explicitly updated from u->headers_in.no_cache and u->headers_in.expired, restoring the behaviour before 8041:0784ab86ad08 (1.23.0) when an error happens while reading the response headers. Reported by Kirill A. Korinsky, https://freenginx.org/pipermail/nginx/2024-April/000082.html
author Maxim Dounin <mdounin@mdounin.ru>
date Tue, 25 Jun 2024 21:44:50 +0300
parents 2cd019520210
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
561
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1 /
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2 / Copyright (C) Igor Sysoev
4412
d620f497c50f Copyright updated.
Maxim Konovalov <maxim@nginx.com>
parents: 3479
diff changeset
3 / Copyright (C) Nginx, Inc.
561
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
4 /
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
5
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
6 / ngx_atomic_uint_t ngx_atomic_cmp_set(ngx_atomic_t *lock,
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
7 / ngx_atomic_uint_t old, ngx_atomic_uint_t set);
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
8 /
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
9 / the arguments are passed in %rdi, %rsi, %rdx
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
10 / the result is returned in the %rax
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
11
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
12 .inline ngx_atomic_cmp_set,0
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
13 movq %rsi, %rax
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
14 lock
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
15 cmpxchgq %rdx, (%rdi)
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
16 setz %al
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
17 movzbq %al, %rax
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
18 .end
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
19
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
20
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
21 / ngx_atomic_int_t ngx_atomic_fetch_add(ngx_atomic_t *value,
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
22 / ngx_atomic_int_t add);
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
23 /
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
24 / the arguments are passed in %rdi, %rsi
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
25 / the result is returned in the %rax
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
26
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
27 .inline ngx_atomic_fetch_add,0
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
28 movq %rsi, %rax
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
29 lock
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
30 xaddq %rax, (%rdi)
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
31 .end
1309
08c6ee7a1b11 Sun Studio 12 compatibility
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
32
08c6ee7a1b11 Sun Studio 12 compatibility
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
33
08c6ee7a1b11 Sun Studio 12 compatibility
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
34 / ngx_cpu_pause()
3479
bfd1912e55a9 use "rep; nop" instead of "pause" on Solaris/amd64
Igor Sysoev <igor@sysoev.ru>
parents: 1309
diff changeset
35 /
bfd1912e55a9 use "rep; nop" instead of "pause" on Solaris/amd64
Igor Sysoev <igor@sysoev.ru>
parents: 1309
diff changeset
36 / the "rep; nop" is used instead of "pause" to avoid the "[ PAUSE ]" hardware
bfd1912e55a9 use "rep; nop" instead of "pause" on Solaris/amd64
Igor Sysoev <igor@sysoev.ru>
parents: 1309
diff changeset
37 / capability added by linker because Solaris/amd64 does not know about it:
bfd1912e55a9 use "rep; nop" instead of "pause" on Solaris/amd64
Igor Sysoev <igor@sysoev.ru>
parents: 1309
diff changeset
38 /
bfd1912e55a9 use "rep; nop" instead of "pause" on Solaris/amd64
Igor Sysoev <igor@sysoev.ru>
parents: 1309
diff changeset
39 / ld.so.1: nginx: fatal: hardware capability unsupported: 0x2000 [ PAUSE ]
1309
08c6ee7a1b11 Sun Studio 12 compatibility
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
40
6474
Ruslan Ermilov <ru@nginx.com>
parents: 4412
diff changeset
41 .inline ngx_cpu_pause,0
Ruslan Ermilov <ru@nginx.com>
parents: 4412
diff changeset
42 rep; nop
Ruslan Ermilov <ru@nginx.com>
parents: 4412
diff changeset
43 .end