Mercurial > hg > nginx-quic
annotate src/core/ngx_array.h @ 6785:d1d0dd69a419
Upstream: added the ngx_http_upstream_resolved_t.name field.
This fixes inconsistency in what is stored in the "host" field.
Normally it would contain the "host" part of the parsed URL
(e.g., proxy_pass with variables), but for the case of an
implicit upstream specified with literal address it contained
the text representation of the socket address (that is, host
including port for IP).
Now the "host" field always contains the "host" part of the URL,
while the text representation of the socket address is stored
in the newly added "name" field.
The ngx_http_upstream_create_round_robin_peer() function was
modified accordingly in a way to be compatible with the code
that does not know about the new "name" field.
The "stream" code was similarly modified except for not adding
compatibility in ngx_stream_upstream_create_round_robin_peer().
This change is also a prerequisite for the next change.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Mon, 31 Oct 2016 18:33:33 +0300 |
parents | 65b895cd0dfa |
children |
rev | line source |
---|---|
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
427
diff
changeset
|
1 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
427
diff
changeset
|
2 /* |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
3 * Copyright (C) Igor Sysoev |
4412 | 4 * Copyright (C) Nginx, Inc. |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
427
diff
changeset
|
5 */ |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
427
diff
changeset
|
6 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
427
diff
changeset
|
7 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
8 #ifndef _NGX_ARRAY_H_INCLUDED_ |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
9 #define _NGX_ARRAY_H_INCLUDED_ |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
10 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
11 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
12 #include <ngx_config.h> |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
13 #include <ngx_core.h> |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
14 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
15 |
5125
65b895cd0dfa
Moved ngx_array_t definition from ngx_core.h to ngx_array.h.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
16 typedef struct { |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
208
diff
changeset
|
17 void *elts; |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
208
diff
changeset
|
18 ngx_uint_t nelts; |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
208
diff
changeset
|
19 size_t size; |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
208
diff
changeset
|
20 ngx_uint_t nalloc; |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
208
diff
changeset
|
21 ngx_pool_t *pool; |
5125
65b895cd0dfa
Moved ngx_array_t definition from ngx_core.h to ngx_array.h.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
22 } ngx_array_t; |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
23 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
24 |
485 | 25 ngx_array_t *ngx_array_create(ngx_pool_t *p, ngx_uint_t n, size_t size); |
26 void ngx_array_destroy(ngx_array_t *a); | |
27 void *ngx_array_push(ngx_array_t *a); | |
28 void *ngx_array_push_n(ngx_array_t *a, ngx_uint_t n); | |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
29 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
30 |
501 | 31 static ngx_inline ngx_int_t |
32 ngx_array_init(ngx_array_t *array, ngx_pool_t *pool, ngx_uint_t n, size_t size) | |
415
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
33 { |
509 | 34 /* |
35 * set "array->nelts" before "array->elts", otherwise MSVC thinks | |
36 * that "array->nelts" may be used without having been initialized | |
37 */ | |
415
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
38 |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
39 array->nelts = 0; |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
40 array->size = size; |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
41 array->nalloc = n; |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
42 array->pool = pool; |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
43 |
509 | 44 array->elts = ngx_palloc(pool, n * size); |
45 if (array->elts == NULL) { | |
46 return NGX_ERROR; | |
47 } | |
48 | |
415
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
49 return NGX_OK; |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
50 } |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
51 |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
52 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
53 #endif /* _NGX_ARRAY_H_INCLUDED_ */ |