<feed xmlns='http://www.w3.org/2005/Atom'>
<title>unit.git/src, branch archive/knownConditionTrueFalse</title>
<subtitle>Universal Web Application Server</subtitle>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/'/>
<entry>
<title>Socket: removed useless port &lt; 1 check.</title>
<updated>2022-06-15T20:14:50+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>andrew@digital-domain.net</email>
</author>
<published>2022-06-14T16:29:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=3de7f7ec36d6291959233c4aa78732e720f62202'/>
<id>3de7f7ec36d6291959233c4aa78732e720f62202</id>
<content type='text'>
In src/nxt_sockaddr.c::nxt_job_sockaddr_inet_parse() there is a check
that port &gt; 0 then there is a check that port &lt; 1 || port &gt; 65535, well
we _know_ it can't be less than 1.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In src/nxt_sockaddr.c::nxt_job_sockaddr_inet_parse() there is a check
that port &gt; 0 then there is a check that port &lt; 1 || port &gt; 65535, well
we _know_ it can't be less than 1.
</pre>
</div>
</content>
</entry>
<entry>
<title>Port: removed useless msg-&gt;cancelled == 0 checks.</title>
<updated>2022-06-15T20:14:50+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>andrew@digital-domain.net</email>
</author>
<published>2022-06-14T16:14:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=a66cd9a0f380b26ac4ba4b329052822d7d2e8e53'/>
<id>a66cd9a0f380b26ac4ba4b329052822d7d2e8e53</id>
<content type='text'>
In src/nxt_port_socket.c::nxt_port_read_msg_process() msg-&gt;cancelled is
set to 0 and is not touched again.

However there are several checks for it being == 0 which are _always_
true, so remove them.

I'm assuming that this is functioning as intended and that setting
msg-&gt;cancelled to 0 is correct.

msg-&gt;cancelled was set 0 unconditionally in commit e227fc9 ("Introducing
application and port shared memory queues."), so I guess the now
redundant checks were simply missed for removal.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In src/nxt_port_socket.c::nxt_port_read_msg_process() msg-&gt;cancelled is
set to 0 and is not touched again.

However there are several checks for it being == 0 which are _always_
true, so remove them.

I'm assuming that this is functioning as intended and that setting
msg-&gt;cancelled to 0 is correct.

msg-&gt;cancelled was set 0 unconditionally in commit e227fc9 ("Introducing
application and port shared memory queues."), so I guess the now
redundant checks were simply missed for removal.
</pre>
</div>
</content>
</entry>
<entry>
<title>Var: relocated nxt_var_is_const() and nxt_var_raw().</title>
<updated>2022-06-15T06:27:50+00:00</updated>
<author>
<name>Zhidao HONG</name>
<email>z.hong@f5.com</email>
</author>
<published>2022-06-15T06:27:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=6a8081d71e805b12d0f7fd32ce72d60babadfc85'/>
<id>6a8081d71e805b12d0f7fd32ce72d60babadfc85</id>
<content type='text'>
No functional changes.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
No functional changes.
</pre>
</div>
</content>
</entry>
<entry>
<title>Removing unused tracking fields and functions.</title>
<updated>2022-06-07T05:59:45+00:00</updated>
<author>
<name>Max Romanov</name>
<email>max.romanov@nginx.com</email>
</author>
<published>2022-06-07T05:59:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=b4540f0960a54908a6bca9c2bd091c239ae76a53'/>
<id>b4540f0960a54908a6bca9c2bd091c239ae76a53</id>
<content type='text'>
The message tracking is unused since 1d84b9e4b459 commit.

This fixes the issue found by Coverity (CID 376263).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The message tracking is unused since 1d84b9e4b459 commit.

This fixes the issue found by Coverity (CID 376263).
</pre>
</div>
</content>
</entry>
<entry>
<title>Router: removed unused code in nxt_router_conf_error().</title>
<updated>2022-06-07T05:43:38+00:00</updated>
<author>
<name>Zhidao HONG</name>
<email>z.hong@f5.com</email>
</author>
<published>2022-06-07T05:43:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=df421e36b368c9595e8adedc078b69f3f0c2466b'/>
<id>df421e36b368c9595e8adedc078b69f3f0c2466b</id>
<content type='text'>
No functional changes.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
No functional changes.
</pre>
</div>
</content>
</entry>
<entry>
<title>Summary: Var: removing all async stuff.</title>
<updated>2022-06-02T01:36:35+00:00</updated>
<author>
<name>Zhidao HONG</name>
<email>z.hong@f5.com</email>
</author>
<published>2022-06-02T01:36:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=0d2d40e23192a281adaf88ce436723c8b7f5e9d3'/>
<id>0d2d40e23192a281adaf88ce436723c8b7f5e9d3</id>
<content type='text'>
No functional changes.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
No functional changes.
</pre>
</div>
</content>
</entry>
<entry>
<title>HTTP: generalized uri encoding.</title>
<updated>2022-05-19T13:18:25+00:00</updated>
<author>
<name>Zhidao HONG</name>
<email>z.hong@f5.com</email>
</author>
<published>2022-05-19T13:18:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=4f16479482f4902aecefdbcd16f3d6e3bf6b67a4'/>
<id>4f16479482f4902aecefdbcd16f3d6e3bf6b67a4</id>
<content type='text'>
No functional changes.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
No functional changes.
</pre>
</div>
</content>
</entry>
<entry>
<title>Node.js: fixed ES modules format in loader.mjs.</title>
<updated>2022-06-02T10:48:27+00:00</updated>
<author>
<name>Andrei Zeliankou</name>
<email>zelenkov@nginx.com</email>
</author>
<published>2022-06-02T10:48:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=bd80039e07500021664a10984977cf64902a4b81'/>
<id>bd80039e07500021664a10984977cf64902a4b81</id>
<content type='text'>
Before Node.js v16.14.0 the "format" value in defaultResolve
was ignored so error was hidden.  For more information see:
https://github.com/nodejs/node/pull/40980
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Before Node.js v16.14.0 the "format" value in defaultResolve
was ignored so error was hidden.  For more information see:
https://github.com/nodejs/node/pull/40980
</pre>
</div>
</content>
</entry>
<entry>
<title>Logging a NULL pointer instead of passing it in the memcpy().</title>
<updated>2022-06-01T15:40:34+00:00</updated>
<author>
<name>Andrei Zeliankou</name>
<email>zelenkov@nginx.com</email>
</author>
<published>2022-06-01T15:40:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=caa05887ff70bbd6338b129959a234ef56f1a287'/>
<id>caa05887ff70bbd6338b129959a234ef56f1a287</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Var: Added $request_uri (as in NGINX).</title>
<updated>2022-05-31T10:40:02+00:00</updated>
<author>
<name>Alejandro Colomar</name>
<email>alx.manpages@gmail.com</email>
</author>
<published>2022-05-26T12:38:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=9bf614cd0874e0ef9fda3145faacd3ef3a5fb0ed'/>
<id>9bf614cd0874e0ef9fda3145faacd3ef3a5fb0ed</id>
<content type='text'>
This supports a new variable $request_uri that contains the path
and the query (See RFC 3986, section 3).  Its contents are percent
encoded.  This is useful for example to redirect HTTP to HTTPS:

{
    "return": "301",
    "location": "https://$host$request_uri"
}

When &lt;http://example.com/foo%23bar?baz&gt; is requested, the server
redirects to &lt;https://example.com/foo%23bar?baz&gt;.

===

Testing:

//diff --git a/src/nxt_http_return.c b/src/nxt_http_return.c
//index 82c9156..adeb3a1 100644
//--- a/src/nxt_http_return.c
//+++ b/src/nxt_http_return.c
//@@ -196,6 +196,7 @@ nxt_http_return_send_ready(nxt_task_t *task,
    void *obj, void *data)
//         field-&gt;value = ctx-&gt;encoded.start;
//         field-&gt;value_length = ctx-&gt;encoded.length;
//     }
//+    fprintf(stderr, "ALX: target[%1$i]: &lt;%2$.*1$s&gt;\n",
    (int)r-&gt;target.length, r-&gt;target.start);
//
//     r-&gt;state = &amp;nxt_http_return_send_state;
//

{
	"listeners": {
		"*:81": {
			"pass": "routes/ru"
		}
	},

	"routes": {
		"ru": [{
			"action": {
				"return": 301,
				"location": "$request_uri"
			}
		}]
	}
}

$ curl -i http://localhost:81/*foo%2Abar?baz#arg
HTTP/1.1 301 Moved Permanently
Location: /*foo%2Abar?baz
Server: Unit/1.27.0
Date: Mon, 30 May 2022 16:04:30 GMT
Content-Length: 0

$ sudo cat /usr/local/unit.log | grep ALX
ALX: target[15]: &lt;/*foo%2Abar?baz&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This supports a new variable $request_uri that contains the path
and the query (See RFC 3986, section 3).  Its contents are percent
encoded.  This is useful for example to redirect HTTP to HTTPS:

{
    "return": "301",
    "location": "https://$host$request_uri"
}

When &lt;http://example.com/foo%23bar?baz&gt; is requested, the server
redirects to &lt;https://example.com/foo%23bar?baz&gt;.

===

Testing:

//diff --git a/src/nxt_http_return.c b/src/nxt_http_return.c
//index 82c9156..adeb3a1 100644
//--- a/src/nxt_http_return.c
//+++ b/src/nxt_http_return.c
//@@ -196,6 +196,7 @@ nxt_http_return_send_ready(nxt_task_t *task,
    void *obj, void *data)
//         field-&gt;value = ctx-&gt;encoded.start;
//         field-&gt;value_length = ctx-&gt;encoded.length;
//     }
//+    fprintf(stderr, "ALX: target[%1$i]: &lt;%2$.*1$s&gt;\n",
    (int)r-&gt;target.length, r-&gt;target.start);
//
//     r-&gt;state = &amp;nxt_http_return_send_state;
//

{
	"listeners": {
		"*:81": {
			"pass": "routes/ru"
		}
	},

	"routes": {
		"ru": [{
			"action": {
				"return": 301,
				"location": "$request_uri"
			}
		}]
	}
}

$ curl -i http://localhost:81/*foo%2Abar?baz#arg
HTTP/1.1 301 Moved Permanently
Location: /*foo%2Abar?baz
Server: Unit/1.27.0
Date: Mon, 30 May 2022 16:04:30 GMT
Content-Length: 0

$ sudo cat /usr/local/unit.log | grep ALX
ALX: target[15]: &lt;/*foo%2Abar?baz&gt;
</pre>
</div>
</content>
</entry>
</feed>
