Mercurial > hg > nginx-quic
annotate src/core/ngx_md5.h @ 6750:cb330cd39030 stable-1.10
HTTP/2: implemented preread buffer for request body (closes #959).
Previously, the stream's window was kept zero in order to prevent a client
from sending the request body before it was requested (see 887cca40ba6a for
details). Until such initial window was acknowledged all requests with
data were rejected (see 0aa07850922f for details).
That approach revealed a number of problems:
1. Some clients (notably MS IE/Edge, Safari, iOS applications) show an error
or even crash if a stream is rejected;
2. This requires at least one RTT for every request with body before the
client receives window update and able to send data.
To overcome these problems the new directive "http2_body_preread_size" is
introduced. It sets the initial window and configures a special per stream
preread buffer that is used to save all incoming data before the body is
requested and processed.
If the directive's value is lower than the default initial window (65535),
as previously, all streams with data will be rejected until the new window
is acknowledged. Otherwise, no special processing is used and all requests
with data are welcome right from the connection start.
The default value is chosen to be 64k, which is bigger than the default
initial window. Setting it to zero is fully complaint to the previous
behavior.
author | Valentin Bartenev <vbart@nginx.com> |
---|---|
date | Tue, 24 May 2016 17:37:52 +0300 |
parents | d620f497c50f |
children | 9eefb38f0005 |
rev | line source |
---|---|
1572 | 1 |
2 /* | |
3 * Copyright (C) Igor Sysoev | |
4412 | 4 * Copyright (C) Nginx, Inc. |
1572 | 5 */ |
6 | |
7 | |
8 #ifndef _NGX_MD5_H_INCLUDED_ | |
9 #define _NGX_MD5_H_INCLUDED_ | |
10 | |
11 | |
12 #include <ngx_config.h> | |
13 #include <ngx_core.h> | |
14 | |
15 | |
3895
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
16 #if (NGX_HAVE_MD5) |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
17 |
1572 | 18 #if (NGX_HAVE_OPENSSL_MD5_H) |
19 #include <openssl/md5.h> | |
20 #else | |
21 #include <md5.h> | |
22 #endif | |
23 | |
24 | |
25 typedef MD5_CTX ngx_md5_t; | |
26 | |
27 | |
28 #if (NGX_OPENSSL_MD5) | |
29 | |
1598 | 30 #define ngx_md5_init MD5_Init |
31 #define ngx_md5_update MD5_Update | |
32 #define ngx_md5_final MD5_Final | |
1572 | 33 |
34 #else | |
35 | |
1598 | 36 #define ngx_md5_init MD5Init |
37 #define ngx_md5_update MD5Update | |
38 #define ngx_md5_final MD5Final | |
1572 | 39 |
40 #endif | |
41 | |
42 | |
3895
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
43 #else /* !NGX_HAVE_MD5 */ |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
44 |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
45 |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
46 typedef struct { |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
47 uint64_t bytes; |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
48 uint32_t a, b, c, d; |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
49 u_char buffer[64]; |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
50 } ngx_md5_t; |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
51 |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
52 |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
53 void ngx_md5_init(ngx_md5_t *ctx); |
3927
38e6f45c5e3d
make built-in ngx_md5_update() interface consistent with other implemenations
Igor Sysoev <igor@sysoev.ru>
parents:
3895
diff
changeset
|
54 void ngx_md5_update(ngx_md5_t *ctx, const void *data, size_t size); |
3895
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
55 void ngx_md5_final(u_char result[16], ngx_md5_t *ctx); |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
56 |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
57 |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
58 #endif |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
59 |
1572 | 60 #endif /* _NGX_MD5_H_INCLUDED_ */ |