Skip to content

Commit c15ea74

Browse files
style: remove duplicate checks and adjust doc
1 parent a6d063b commit c15ea74

File tree

3 files changed

+8
-23
lines changed

3 files changed

+8
-23
lines changed

README.markdown

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5585,16 +5585,11 @@ ngx.escape_uri
55855585

55865586
**context:** *init_by_lua*, init_worker_by_lua*, set_by_lua*, rewrite_by_lua*, access_by_lua*, content_by_lua*, header_filter_by_lua*, body_filter_by_lua*, log_by_lua*, ngx.timer.*, balancer_by_lua*, ssl_certificate_by_lua*, ssl_session_fetch_by_lua*, ssl_session_store_by_lua**
55875587

5588-
Escape `str` as a URI component.
5589-
55905588
Since `v0.10.16rc6`, this function accepts an optional `type` argument.
5591-
```lua
5592-
5593-
type = 0 (Escape <code>str</code> as a URI)
5594-
type = 2 (Escape <code>str</code> as a URI component)
5595-
```
5596-
when type set to 0, " ", "#", "%", "?", 0x00-0x1F, 0x7F-0xFF will be escaped.
5597-
when type set to 2, all characters excepter ALPHA, DIGIT, "-", ".", "_", "~" will be escaped.
5589+
When `type` is set to 0, escape `str` as a URI. And these
5590+
characters " ", "#", "%", "?", 0x00-0x1F, 0x7F-0xFF will be escaped.
5591+
When `type` is set to 2 (which is the default), escape `str`
5592+
as a URI component. All characters excepter ALPHA, DIGIT, "-", ".", "_", "~" will be escaped.
55985593

55995594
[Back to TOC](#nginx-api-for-lua)
56005595

doc/HttpLuaModule.wiki

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4690,15 +4690,11 @@ This method was introduced in the <code>0.5.0rc30</code> release.
46904690
46914691
'''context:''' ''init_by_lua*, init_worker_by_lua*, set_by_lua*, rewrite_by_lua*, access_by_lua*, content_by_lua*, header_filter_by_lua*, body_filter_by_lua*, log_by_lua*, ngx.timer.*, balancer_by_lua*, ssl_certificate_by_lua*, ssl_session_fetch_by_lua*, ssl_session_store_by_lua*''
46924692
4693-
Escape <code>str</code> as a URI component.
4694-
46954693
Since `v0.10.16rc6`, this function accepts an optional <code>type</code> argument.
4696-
<geshi lang="lua">
4697-
type = 0 (Escape <code>str</code> as a URI)
4698-
type = 2 (Escape <code>str</code> as a URI component)
4699-
</geshi>
4700-
when type set to 0, " ", "#", "%", "?", 0x00-0x1F, 0x7F-0xFF will be escaped.
4701-
when type set to 2, all characters excepter ALPHA, DIGIT, "-", ".", "_", "~" will be escaped.
4694+
When <code>type</code> is set to 0, escape <code>str</code> as a URI. And these
4695+
characters " ", "#", "%", "?", 0x00-0x1F, 0x7F-0xFF will be escaped.
4696+
When <code>type</code> is set to 2 (which is the default), escape <code>str</code>
4697+
as a URI component. All characters excepter ALPHA, DIGIT, "-", ".", "_", "~" will be escaped.
47024698
47034699
== ngx.unescape_uri ==
47044700

src/ngx_http_lua_string.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,6 @@ size_t
436436
ngx_http_lua_ffi_uri_escaped_length(const u_char *src, size_t len,
437437
int type)
438438
{
439-
if (type < NGX_ESCAPE_URI || type > NGX_ESCAPE_MAIL_AUTH) {
440-
return -1;
441-
}
442439
return len + 2 * ngx_http_lua_escape_uri(NULL, (u_char *) src, len, type);
443440
}
444441

@@ -447,9 +444,6 @@ void
447444
ngx_http_lua_ffi_escape_uri(const u_char *src, size_t len, u_char *dst,
448445
int type)
449446
{
450-
if (type < NGX_ESCAPE_URI || type > NGX_ESCAPE_MAIL_AUTH) {
451-
return;
452-
}
453447
ngx_http_lua_escape_uri(dst, (u_char *) src, len, type);
454448
}
455449

0 commit comments

Comments
 (0)