Skip to content

Commit

Permalink
Merge pull request #249 from chobits/for_pull_request
Browse files Browse the repository at this point in the history
refactor logic of handling proxy timer
  • Loading branch information
chobits authored Nov 29, 2022
2 parents b998d16 + 0bc35f6 commit 917cd1a
Show file tree
Hide file tree
Showing 7 changed files with 446 additions and 308 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@ jobs:
sudo apt install -y libpcre3 libpcre3-dev
sudo apt-get install libnet-dns-perl
sudo cpan -T -i Test::More
- name: 'checkout luajit2'
uses: actions/checkout@v3
with:
repository: openresty/luajit2
path: luajit2
- name: install luajit
working-directory: luajit2
run: |
pwd
wget https://luajit.org/download/LuaJIT-2.1.0-beta3.tar.gz
tar xf LuaJIT-2.1.0-beta3.tar.gz
cd LuaJIT-2.1.0-beta3
make -j
sudo make install
ls /usr/local/lib/ |grep lua
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/test_nginx_lastest_commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ jobs:
sudo apt install -y libpcre3 libpcre3-dev
sudo apt-get install libnet-dns-perl
sudo cpan -T -i Test::More
- name: 'checkout luajit2'
uses: actions/checkout@v3
with:
repository: openresty/luajit2
path: luajit2
- name: install luajit
working-directory: luajit2
run: |
pwd
wget https://luajit.org/download/LuaJIT-2.1.0-beta3.tar.gz
tar xf LuaJIT-2.1.0-beta3.tar.gz
cd LuaJIT-2.1.0-beta3
make -j
sudo make install
ls /usr/local/lib/ |grep lua
Expand Down
50 changes: 32 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ Table of Contents
* [proxy_connect](#proxy_connect)
* [proxy_connect_allow](#proxy_connect_allow)
* [proxy_connect_connect_timeout](#proxy_connect_connect_timeout)
* [proxy_connect_read_timeout](#proxy_connect_read_timeout)
* [proxy_connect_send_timeout](#proxy_connect_send_timeout)
* [proxy_connect_data_timeout](#proxy_connect_data_timeout)
* [proxy_connect_read_timeout(deprecated)](#proxy_connect_read_timeout)
* [proxy_connect_send_timeout(deprecated)](#proxy_connect_send_timeout)
* [proxy_connect_address](#proxy_connect_address)
* [proxy_connect_bind](#proxy_connect_bind)
* [proxy_connect_response](#proxy_connect_response)
Expand All @@ -34,8 +35,9 @@ Table of Contents
* [$connect_port](#connect_port)
* [$connect_addr](#connect_addr)
* [$proxy_connect_connect_timeout](#proxy_connect_connect_timeout-1)
* [$proxy_connect_read_timeout](#proxy_connect_read_timeout-1)
* [$proxy_connect_send_timeout](#proxy_connect_send_timeout-1)
* [$proxy_connect_data_timeout](#proxy_connect_data_timeout-1)
* [$proxy_connect_read_timeout(deprecated)](#proxy_connect_read_timeout-1)
* [$proxy_connect_send_timeout(deprecated)](#proxy_connect_send_timeout-1)
* [$proxy_connect_resolve_time](#proxy_connect_resolve_time)
* [$proxy_connect_connect_time](#proxy_connect_connect_time)
* [$proxy_connect_first_byte_time](#proxy_connect_first_byte_time)
Expand Down Expand Up @@ -67,8 +69,7 @@ Configuration Example
proxy_connect;
proxy_connect_allow 443 563;
proxy_connect_connect_timeout 10s;
proxy_connect_read_timeout 10s;
proxy_connect_send_timeout 10s;
proxy_connect_data_timeout 10s;
# forward proxy for non-CONNECT request
location / {
Expand Down Expand Up @@ -329,6 +330,14 @@ Context: `server`

Defines a timeout for establishing a connection with a proxied server.

proxy_connect_data_timeout
--------------------------

Syntax: **proxy_connect_data_timeout `time`**
Default: `60s`
Context: `server`

Sets the timeout between two successive read or write operations on client or proxied server connections. If no data is transmitted within this time, the connection is closed.

proxy_connect_read_timeout
--------------------------
Expand All @@ -337,9 +346,9 @@ Syntax: **proxy_connect_read_timeout `time`**
Default: `60s`
Context: `server`

Defines a timeout for reading a response from the proxied server.
The timeout is set only between two successive read operations, not for the transmission of the whole response.
If the proxied server does not transmit anything within this time, the connection is closed.
Deprecated.

It has the same function as the directive `proxy_connect_data_timeout` for compatibility. You can configure only one of the directives (`proxy_connect_data_timeout` or `proxy_connect_read_timeout`).

proxy_connect_send_timeout
--------------------------
Expand All @@ -348,9 +357,9 @@ Syntax: **proxy_connect_send_timeout `time`**
Default: `60s`
Context: `server`

Sets a timeout for transmitting a request to the proxied server.
The timeout is set only between two successive write operations, not for the transmission of the whole request.
If the proxied server does not receive anything within this time, the connection is closed.
Deprecated.

It has no function.

proxy_connect_address
---------------------
Expand Down Expand Up @@ -453,27 +462,32 @@ For example:
# Set default value
proxy_connect_connect_timeout 10s;
proxy_connect_read_timeout 10s;
proxy_connect_send_timeout 10s;
proxy_connect_data_timeout 10s;
# Overlap default value
if ($host = "test.com") {
set $proxy_connect_connect_timeout "10ms";
set $proxy_connect_read_timeout "10ms";
set $proxy_connect_send_timeout "10ms";
set $proxy_connect_data_timeout "10ms";
}
```

$proxy_connect_data_timeout
---------------------------

Get or set a timeout of [`proxy_connect_data_timeout` directive](#proxy_connect_data_timeout).

$proxy_connect_read_timeout
---------------------------

Get or set a timeout of [`proxy_connect_read_timeout` directive](#proxy_connect_read_timeout).
Deprecated.
It still can get or set a timeout of [`proxy_connect_data_timeout` directive](#proxy_connect_data_timeout) for compatibility.

$proxy_connect_send_timeout
---------------------------

Get or set a timeout of [`proxy_connect_send_timeout` directive](#proxy_connect_send_timeout).
Deprecated.
It has no function.

$proxy_connect_resolve_time
---------------------------
Expand Down
Loading

0 comments on commit 917cd1a

Please sign in to comment.