Mercurial > hg > nginx-quic
annotate src/http/modules/perl/nginx.pm @ 7892:2096b21fcd10
gRPC: RST_STREAM(NO_ERROR) handling (ticket #1792).
As per https://tools.ietf.org/html/rfc7540#section-8.1,
: A server can send a complete response prior to the client
: sending an entire request if the response does not depend on
: any portion of the request that has not been sent and
: received. When this is true, a server MAY request that the
: client abort transmission of a request without error by
: sending a RST_STREAM with an error code of NO_ERROR after
: sending a complete response (i.e., a frame with the
: END_STREAM flag). Clients MUST NOT discard responses as a
: result of receiving such a RST_STREAM, though clients can
: always discard responses at their discretion for other
: reasons.
Previously, RST_STREAM(NO_ERROR) received from upstream after
a frame with the END_STREAM flag was incorrectly treated as an
error. Now, a single RST_STREAM(NO_ERROR) is properly handled.
This fixes problems observed with modern grpc-c [1], as well
as with the Go gRPC module.
[1] https://github.com/grpc/grpc/pull/1661
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Thu, 23 Apr 2020 15:10:24 +0300 |
parents | be5cfa918bfc |
children |
rev | line source |
---|---|
599 | 1 package nginx; |
2 | |
3 use 5.006001; | |
4 use strict; | |
5 use warnings; | |
6 | |
7 require Exporter; | |
8 | |
9 our @ISA = qw(Exporter); | |
10 | |
11 our @EXPORT = qw( | |
12 OK | |
13 DECLINED | |
914 | 14 |
599 | 15 HTTP_OK |
914 | 16 HTTP_CREATED |
3604 | 17 HTTP_ACCEPTED |
914 | 18 HTTP_NO_CONTENT |
19 HTTP_PARTIAL_CONTENT | |
20 | |
21 HTTP_MOVED_PERMANENTLY | |
22 HTTP_MOVED_TEMPORARILY | |
599 | 23 HTTP_REDIRECT |
4491
d11f86a16e3b
Added support for the 307 Temporary Redirect.
Ruslan Ermilov <ru@nginx.com>
parents:
4483
diff
changeset
|
24 HTTP_SEE_OTHER |
914 | 25 HTTP_NOT_MODIFIED |
4491
d11f86a16e3b
Added support for the 307 Temporary Redirect.
Ruslan Ermilov <ru@nginx.com>
parents:
4483
diff
changeset
|
26 HTTP_TEMPORARY_REDIRECT |
6977
be5cfa918bfc
Added support for the "308 Permanent Redirect" (ticket #877).
Simon Leblanc <contact@leblanc-simon.eu>
parents:
5146
diff
changeset
|
27 HTTP_PERMANENT_REDIRECT |
914 | 28 |
29 HTTP_BAD_REQUEST | |
30 HTTP_UNAUTHORIZED | |
31 HTTP_PAYMENT_REQUIRED | |
32 HTTP_FORBIDDEN | |
599 | 33 HTTP_NOT_FOUND |
914 | 34 HTTP_NOT_ALLOWED |
35 HTTP_NOT_ACCEPTABLE | |
36 HTTP_REQUEST_TIME_OUT | |
37 HTTP_CONFLICT | |
38 HTTP_GONE | |
39 HTTP_LENGTH_REQUIRED | |
40 HTTP_REQUEST_ENTITY_TOO_LARGE | |
41 HTTP_REQUEST_URI_TOO_LARGE | |
42 HTTP_UNSUPPORTED_MEDIA_TYPE | |
43 HTTP_RANGE_NOT_SATISFIABLE | |
44 | |
45 HTTP_INTERNAL_SERVER_ERROR | |
599 | 46 HTTP_SERVER_ERROR |
914 | 47 HTTP_NOT_IMPLEMENTED |
48 HTTP_BAD_GATEWAY | |
49 HTTP_SERVICE_UNAVAILABLE | |
50 HTTP_GATEWAY_TIME_OUT | |
51 HTTP_INSUFFICIENT_STORAGE | |
599 | 52 ); |
53 | |
5146
f45b83d20cfb
Simplified nginx version maintenance.
Ruslan Ermilov <ru@nginx.com>
parents:
5140
diff
changeset
|
54 our $VERSION = '%%VERSION%%'; |
599 | 55 |
56 require XSLoader; | |
57 XSLoader::load('nginx', $VERSION); | |
58 | |
59 # Preloaded methods go here. | |
60 | |
914 | 61 use constant OK => 0; |
62 use constant DECLINED => -5; | |
63 | |
64 use constant HTTP_OK => 200; | |
65 use constant HTTP_CREATED => 201; | |
3604 | 66 use constant HTTP_ACCEPTED => 202; |
914 | 67 use constant HTTP_NO_CONTENT => 204; |
68 use constant HTTP_PARTIAL_CONTENT => 206; | |
69 | |
70 use constant HTTP_MOVED_PERMANENTLY => 301; | |
71 use constant HTTP_MOVED_TEMPORARILY => 302; | |
72 use constant HTTP_REDIRECT => 302; | |
4491
d11f86a16e3b
Added support for the 307 Temporary Redirect.
Ruslan Ermilov <ru@nginx.com>
parents:
4483
diff
changeset
|
73 use constant HTTP_SEE_OTHER => 303; |
914 | 74 use constant HTTP_NOT_MODIFIED => 304; |
4491
d11f86a16e3b
Added support for the 307 Temporary Redirect.
Ruslan Ermilov <ru@nginx.com>
parents:
4483
diff
changeset
|
75 use constant HTTP_TEMPORARY_REDIRECT => 307; |
6977
be5cfa918bfc
Added support for the "308 Permanent Redirect" (ticket #877).
Simon Leblanc <contact@leblanc-simon.eu>
parents:
5146
diff
changeset
|
76 use constant HTTP_PERMANENT_REDIRECT => 308; |
599 | 77 |
914 | 78 use constant HTTP_BAD_REQUEST => 400; |
79 use constant HTTP_UNAUTHORIZED => 401; | |
80 use constant HTTP_PAYMENT_REQUIRED => 402; | |
81 use constant HTTP_FORBIDDEN => 403; | |
82 use constant HTTP_NOT_FOUND => 404; | |
83 use constant HTTP_NOT_ALLOWED => 405; | |
84 use constant HTTP_NOT_ACCEPTABLE => 406; | |
85 use constant HTTP_REQUEST_TIME_OUT => 408; | |
86 use constant HTTP_CONFLICT => 409; | |
87 use constant HTTP_GONE => 410; | |
88 use constant HTTP_LENGTH_REQUIRED => 411; | |
89 use constant HTTP_REQUEST_ENTITY_TOO_LARGE => 413; | |
90 use constant HTTP_REQUEST_URI_TOO_LARGE => 414; | |
91 use constant HTTP_UNSUPPORTED_MEDIA_TYPE => 415; | |
92 use constant HTTP_RANGE_NOT_SATISFIABLE => 416; | |
93 | |
94 use constant HTTP_INTERNAL_SERVER_ERROR => 500; | |
95 use constant HTTP_SERVER_ERROR => 500; | |
96 use constant HTTP_NOT_IMPLEMENTED => 501; | |
97 use constant HTTP_BAD_GATEWAY => 502; | |
98 use constant HTTP_SERVICE_UNAVAILABLE => 503; | |
99 use constant HTTP_GATEWAY_TIME_OUT => 504; | |
100 use constant HTTP_INSUFFICIENT_STORAGE => 507; | |
599 | 101 |
102 | |
1178
a77f6980de50
rename $r->rflush to $r->flush
Igor Sysoev <igor@sysoev.ru>
parents:
1177
diff
changeset
|
103 sub rflush { |
a77f6980de50
rename $r->rflush to $r->flush
Igor Sysoev <igor@sysoev.ru>
parents:
1177
diff
changeset
|
104 my $r = shift; |
a77f6980de50
rename $r->rflush to $r->flush
Igor Sysoev <igor@sysoev.ru>
parents:
1177
diff
changeset
|
105 |
a77f6980de50
rename $r->rflush to $r->flush
Igor Sysoev <igor@sysoev.ru>
parents:
1177
diff
changeset
|
106 $r->flush; |
a77f6980de50
rename $r->rflush to $r->flush
Igor Sysoev <igor@sysoev.ru>
parents:
1177
diff
changeset
|
107 } |
a77f6980de50
rename $r->rflush to $r->flush
Igor Sysoev <igor@sysoev.ru>
parents:
1177
diff
changeset
|
108 |
a77f6980de50
rename $r->rflush to $r->flush
Igor Sysoev <igor@sysoev.ru>
parents:
1177
diff
changeset
|
109 |
599 | 110 1; |
111 __END__ | |
112 | |
113 =head1 NAME | |
114 | |
115 nginx - Perl interface to the nginx HTTP server API | |
116 | |
117 =head1 SYNOPSIS | |
118 | |
119 use nginx; | |
120 | |
121 =head1 DESCRIPTION | |
122 | |
123 This module provides a Perl interface to the nginx HTTP server API. | |
124 | |
125 | |
126 =head1 SEE ALSO | |
127 | |
4977
b216d212920b
Brought the link to ngx_http_perl_module documentation up to date.
Ruslan Ermilov <ru@nginx.com>
parents:
4942
diff
changeset
|
128 http://nginx.org/en/docs/http/ngx_http_perl_module.html |
599 | 129 |
130 =head1 AUTHOR | |
131 | |
132 Igor Sysoev | |
133 | |
134 =head1 COPYRIGHT AND LICENSE | |
135 | |
136 Copyright (C) Igor Sysoev | |
4411 | 137 Copyright (C) Nginx, Inc. |
599 | 138 |
139 | |
140 =cut |