mirror of
https://github.com/lunarmodules/luasocket.git
synced 2025-04-06 00:46:46 +02:00
Compare commits
10 Commits
c450ff2788
...
3e56a29aee
Author | SHA1 | Date | |
---|---|---|---|
|
3e56a29aee | ||
|
58c76080a0 | ||
|
250e4d48f7 | ||
|
f139105c98 | ||
|
66cdeca663 | ||
|
676e5f3501 | ||
|
4dad084cfd | ||
|
b281e6f717 | ||
|
784b0631e1 | ||
|
a1b5d3abd1 |
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
@ -13,7 +13,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
luaVersion: [ "5.4", "5.3", "5.2", "5.1", "luajit", "luajit-openresty" ]
|
luaVersion: [ "5.4", "5.3", "5.2", "5.1", "luajit", "luajit-openresty" ]
|
||||||
platform: [ "ubuntu-22.04", "macos-11", "windows-2022" ]
|
platform: [ "ubuntu-22.04", "macos-14", "windows-2022" ]
|
||||||
runs-on: ${{ matrix.platform }}
|
runs-on: ${{ matrix.platform }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@ -22,11 +22,11 @@ jobs:
|
|||||||
if: ${{ startsWith(matrix.platform, 'windows') && !startsWith(matrix.luaVersion, 'luajit') }}
|
if: ${{ startsWith(matrix.platform, 'windows') && !startsWith(matrix.luaVersion, 'luajit') }}
|
||||||
uses: ilammy/msvc-dev-cmd@v1
|
uses: ilammy/msvc-dev-cmd@v1
|
||||||
- name: Setup ‘lua’
|
- name: Setup ‘lua’
|
||||||
uses: leso-kn/gh-actions-lua@v11-staging
|
uses: luarocks/gh-actions-lua@v10
|
||||||
with:
|
with:
|
||||||
luaVersion: ${{ matrix.luaVersion }}
|
luaVersion: ${{ matrix.luaVersion }}
|
||||||
- name: Setup ‘luarocks’
|
- name: Setup ‘luarocks’
|
||||||
uses: hishamhm/gh-actions-luarocks@master
|
uses: luarocks/gh-actions-luarocks@v5
|
||||||
- name: Make and install
|
- name: Make and install
|
||||||
run: |
|
run: |
|
||||||
luarocks make -- luasocket-scm-3.rockspec
|
luarocks make -- luasocket-scm-3.rockspec
|
||||||
|
@ -149,8 +149,8 @@ wild-card address).
|
|||||||
<!-- gettimeout +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
<!-- gettimeout +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
|
||||||
<p class="name" id="gettimeout">
|
<p class="name" id="gettimeout">
|
||||||
connected:<b>settimeout(</b>value<b>)</b><br>
|
connected:<b>gettimeout()</b><br>
|
||||||
unconnected:<b>settimeout(</b>value<b>)</b>
|
unconnected:<b>gettimeout()</b>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p class="description">
|
<p class="description">
|
||||||
|
@ -60,7 +60,7 @@ An URL is defined by the following grammar:
|
|||||||
|
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<tt>
|
<tt>
|
||||||
<url> ::= [<scheme>:][//<authority>][/<path>][;<params>][?<query>][#<fragment>]<br>
|
<url> ::= [<scheme>:][//<authority>][/<path>][?<query>][#<fragment>]<br>
|
||||||
<authority> ::= [<userinfo>@]<host>[:<port>]<br>
|
<authority> ::= [<userinfo>@]<host>[:<port>]<br>
|
||||||
<userinfo> ::= <user>[:<password>]<br>
|
<userinfo> ::= <user>[:<password>]<br>
|
||||||
<path> ::= {<segment>/}<segment><br>
|
<path> ::= {<segment>/}<segment><br>
|
||||||
@ -225,7 +225,6 @@ parsed_url = {<br>
|
|||||||
scheme = <i>string</i>,<br>
|
scheme = <i>string</i>,<br>
|
||||||
authority = <i>string</i>,<br>
|
authority = <i>string</i>,<br>
|
||||||
path = <i>string</i>,<br>
|
path = <i>string</i>,<br>
|
||||||
params = <i>string</i>,<br>
|
|
||||||
query = <i>string</i>,<br>
|
query = <i>string</i>,<br>
|
||||||
fragment = <i>string</i>,<br>
|
fragment = <i>string</i>,<br>
|
||||||
userinfo = <i>string</i>,<br>
|
userinfo = <i>string</i>,<br>
|
||||||
@ -255,7 +254,6 @@ parsed_url = url.parse("ftp://root:passwd@unsafe.org/pub/virus.exe;type=i")
|
|||||||
-- scheme = "ftp",
|
-- scheme = "ftp",
|
||||||
-- authority = "root:passwd@unsafe.org",
|
-- authority = "root:passwd@unsafe.org",
|
||||||
-- path = "/pub/virus.exe",
|
-- path = "/pub/virus.exe",
|
||||||
-- params = "type=i",
|
|
||||||
-- userinfo = "root:passwd",
|
-- userinfo = "root:passwd",
|
||||||
-- host = "unsafe.org",
|
-- host = "unsafe.org",
|
||||||
-- user = "root",
|
-- user = "root",
|
||||||
|
@ -207,7 +207,6 @@ local function adjusturi(reqt)
|
|||||||
if not reqt.proxy and not _M.PROXY then
|
if not reqt.proxy and not _M.PROXY then
|
||||||
u = {
|
u = {
|
||||||
path = socket.try(reqt.path, "invalid path 'nil'"),
|
path = socket.try(reqt.path, "invalid path 'nil'"),
|
||||||
params = reqt.params,
|
|
||||||
query = reqt.query,
|
query = reqt.query,
|
||||||
fragment = reqt.fragment
|
fragment = reqt.fragment
|
||||||
}
|
}
|
||||||
|
17
src/url.lua
17
src/url.lua
@ -125,7 +125,7 @@ end
|
|||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- Parses a url and returns a table with all its parts according to RFC 2396
|
-- Parses a url and returns a table with all its parts according to RFC 2396
|
||||||
-- The following grammar describes the names given to the URL parts
|
-- The following grammar describes the names given to the URL parts
|
||||||
-- <url> ::= <scheme>://<authority>/<path>;<params>?<query>#<fragment>
|
-- <url> ::= <scheme>://<authority>/<path>?<query>#<fragment>
|
||||||
-- <authority> ::= <userinfo>@<host>:<port>
|
-- <authority> ::= <userinfo>@<host>:<port>
|
||||||
-- <userinfo> ::= <user>[:<password>]
|
-- <userinfo> ::= <user>[:<password>]
|
||||||
-- <path> :: = {<segment>/}<segment>
|
-- <path> :: = {<segment>/}<segment>
|
||||||
@ -136,7 +136,7 @@ end
|
|||||||
-- table with the following fields, where RFC naming conventions have
|
-- table with the following fields, where RFC naming conventions have
|
||||||
-- been preserved:
|
-- been preserved:
|
||||||
-- scheme, authority, userinfo, user, password, host, port,
|
-- scheme, authority, userinfo, user, password, host, port,
|
||||||
-- path, params, query, fragment
|
-- path, query, fragment
|
||||||
-- Obs:
|
-- Obs:
|
||||||
-- the leading '/' in {/<path>} is considered part of <path>
|
-- the leading '/' in {/<path>} is considered part of <path>
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
@ -166,11 +166,6 @@ function _M.parse(url, default)
|
|||||||
parsed.query = q
|
parsed.query = q
|
||||||
return ""
|
return ""
|
||||||
end)
|
end)
|
||||||
-- get params
|
|
||||||
url = string.gsub(url, "%;(.*)", function(p)
|
|
||||||
parsed.params = p
|
|
||||||
return ""
|
|
||||||
end)
|
|
||||||
-- path is whatever was left
|
-- path is whatever was left
|
||||||
if url ~= "" then parsed.path = url end
|
if url ~= "" then parsed.path = url end
|
||||||
local authority = parsed.authority
|
local authority = parsed.authority
|
||||||
@ -203,7 +198,6 @@ function _M.build(parsed)
|
|||||||
--local ppath = _M.parse_path(parsed.path or "")
|
--local ppath = _M.parse_path(parsed.path or "")
|
||||||
--local url = _M.build_path(ppath)
|
--local url = _M.build_path(ppath)
|
||||||
local url = parsed.path or ""
|
local url = parsed.path or ""
|
||||||
if parsed.params then url = url .. ";" .. parsed.params end
|
|
||||||
if parsed.query then url = url .. "?" .. parsed.query end
|
if parsed.query then url = url .. "?" .. parsed.query end
|
||||||
local authority = parsed.authority
|
local authority = parsed.authority
|
||||||
if parsed.host then
|
if parsed.host then
|
||||||
@ -258,11 +252,8 @@ function _M.absolute(base_url, relative_url)
|
|||||||
relative_parsed.authority = base_parsed.authority
|
relative_parsed.authority = base_parsed.authority
|
||||||
if not relative_parsed.path then
|
if not relative_parsed.path then
|
||||||
relative_parsed.path = base_parsed.path
|
relative_parsed.path = base_parsed.path
|
||||||
if not relative_parsed.params then
|
if not relative_parsed.query then
|
||||||
relative_parsed.params = base_parsed.params
|
relative_parsed.query = base_parsed.query
|
||||||
if not relative_parsed.query then
|
|
||||||
relative_parsed.query = base_parsed.query
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
relative_parsed.path = absolute_path(base_parsed.path or "",
|
relative_parsed.path = absolute_path(base_parsed.path or "",
|
||||||
|
@ -99,8 +99,7 @@ check_parse_url{
|
|||||||
userinfo = "user:pass$%?#wd",
|
userinfo = "user:pass$%?#wd",
|
||||||
password = "pass$%?#wd",
|
password = "pass$%?#wd",
|
||||||
user = "user",
|
user = "user",
|
||||||
path = "/path",
|
path = "/path;params",
|
||||||
params = "params",
|
|
||||||
query = "query",
|
query = "query",
|
||||||
fragment = "fragment"
|
fragment = "fragment"
|
||||||
}
|
}
|
||||||
@ -113,8 +112,7 @@ check_parse_url{
|
|||||||
userinfo = "user:pass?#wd",
|
userinfo = "user:pass?#wd",
|
||||||
password = "pass?#wd",
|
password = "pass?#wd",
|
||||||
user = "user",
|
user = "user",
|
||||||
path = "/path",
|
path = "/path;params",
|
||||||
params = "params",
|
|
||||||
query = "query",
|
query = "query",
|
||||||
fragment = "fragment"
|
fragment = "fragment"
|
||||||
}
|
}
|
||||||
@ -127,8 +125,7 @@ check_parse_url{
|
|||||||
userinfo = "user:pass-wd",
|
userinfo = "user:pass-wd",
|
||||||
password = "pass-wd",
|
password = "pass-wd",
|
||||||
user = "user",
|
user = "user",
|
||||||
path = "/path",
|
path = "/path;params",
|
||||||
params = "params",
|
|
||||||
query = "query",
|
query = "query",
|
||||||
fragment = "fragment"
|
fragment = "fragment"
|
||||||
}
|
}
|
||||||
@ -141,8 +138,7 @@ check_parse_url{
|
|||||||
userinfo = "user:pass#wd",
|
userinfo = "user:pass#wd",
|
||||||
password = "pass#wd",
|
password = "pass#wd",
|
||||||
user = "user",
|
user = "user",
|
||||||
path = "/path",
|
path = "/path;params",
|
||||||
params = "params",
|
|
||||||
query = "query",
|
query = "query",
|
||||||
fragment = "fragment"
|
fragment = "fragment"
|
||||||
}
|
}
|
||||||
@ -155,8 +151,7 @@ check_parse_url{
|
|||||||
userinfo = "user:pass#wd",
|
userinfo = "user:pass#wd",
|
||||||
password = "pass#wd",
|
password = "pass#wd",
|
||||||
user = "user",
|
user = "user",
|
||||||
path = "/path",
|
path = "/path;params",
|
||||||
params = "params",
|
|
||||||
query = "query",
|
query = "query",
|
||||||
}
|
}
|
||||||
check_parse_url{
|
check_parse_url{
|
||||||
@ -167,8 +162,7 @@ check_parse_url{
|
|||||||
port = "port",
|
port = "port",
|
||||||
userinfo = "userinfo",
|
userinfo = "userinfo",
|
||||||
user = "userinfo",
|
user = "userinfo",
|
||||||
path = "/path",
|
path = "/path;params",
|
||||||
params = "params",
|
|
||||||
query = "query",
|
query = "query",
|
||||||
fragment = "fragment"
|
fragment = "fragment"
|
||||||
}
|
}
|
||||||
@ -182,8 +176,7 @@ check_parse_url{
|
|||||||
userinfo = "user:password",
|
userinfo = "user:password",
|
||||||
user = "user",
|
user = "user",
|
||||||
password = "password",
|
password = "password",
|
||||||
path = "/path",
|
path = "/path;params",
|
||||||
params = "params",
|
|
||||||
query = "query",
|
query = "query",
|
||||||
fragment = "fragment",
|
fragment = "fragment",
|
||||||
}
|
}
|
||||||
@ -196,8 +189,7 @@ check_parse_url{
|
|||||||
port = "port",
|
port = "port",
|
||||||
userinfo = "userinfo",
|
userinfo = "userinfo",
|
||||||
user = "userinfo",
|
user = "userinfo",
|
||||||
path = "/path",
|
path = "/path;params",
|
||||||
params = "params",
|
|
||||||
query = "query",
|
query = "query",
|
||||||
fragment = ""
|
fragment = ""
|
||||||
}
|
}
|
||||||
@ -210,8 +202,7 @@ check_parse_url{
|
|||||||
port = "port",
|
port = "port",
|
||||||
userinfo = "userinfo",
|
userinfo = "userinfo",
|
||||||
user = "userinfo",
|
user = "userinfo",
|
||||||
path = "/path",
|
path = "/path;params",
|
||||||
params = "params",
|
|
||||||
query = "",
|
query = "",
|
||||||
fragment = "fragment"
|
fragment = "fragment"
|
||||||
}
|
}
|
||||||
@ -224,8 +215,7 @@ check_parse_url{
|
|||||||
port = "port",
|
port = "port",
|
||||||
userinfo = "userinfo",
|
userinfo = "userinfo",
|
||||||
user = "userinfo",
|
user = "userinfo",
|
||||||
path = "/path",
|
path = "/path;params",
|
||||||
params = "params",
|
|
||||||
fragment = "fragment"
|
fragment = "fragment"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,8 +227,7 @@ check_parse_url{
|
|||||||
port = "port",
|
port = "port",
|
||||||
userinfo = "userinfo",
|
userinfo = "userinfo",
|
||||||
user = "userinfo",
|
user = "userinfo",
|
||||||
path = "/path",
|
path = "/path;",
|
||||||
params = "",
|
|
||||||
query = "query",
|
query = "query",
|
||||||
fragment = "fragment"
|
fragment = "fragment"
|
||||||
}
|
}
|
||||||
@ -264,8 +253,7 @@ check_parse_url{
|
|||||||
port = "port",
|
port = "port",
|
||||||
userinfo = "userinfo",
|
userinfo = "userinfo",
|
||||||
user = "userinfo",
|
user = "userinfo",
|
||||||
path = "/",
|
path = "/;params",
|
||||||
params = "params",
|
|
||||||
query = "query",
|
query = "query",
|
||||||
fragment = "fragment"
|
fragment = "fragment"
|
||||||
}
|
}
|
||||||
@ -287,8 +275,7 @@ check_parse_url{
|
|||||||
port = "port",
|
port = "port",
|
||||||
userinfo = "userinfo",
|
userinfo = "userinfo",
|
||||||
user = "userinfo",
|
user = "userinfo",
|
||||||
path = "/path",
|
path = "/path;params",
|
||||||
params = "params",
|
|
||||||
query = "query",
|
query = "query",
|
||||||
fragment = "fragment"
|
fragment = "fragment"
|
||||||
}
|
}
|
||||||
@ -438,8 +425,7 @@ check_parse_url{
|
|||||||
port = "port",
|
port = "port",
|
||||||
userinfo = "userinfo",
|
userinfo = "userinfo",
|
||||||
user = "userinfo",
|
user = "userinfo",
|
||||||
path = "/path",
|
path = "/path;params",
|
||||||
params = "params",
|
|
||||||
query = "query",
|
query = "query",
|
||||||
fragment = "fragment"
|
fragment = "fragment"
|
||||||
}
|
}
|
||||||
@ -453,8 +439,7 @@ check_parse_url{
|
|||||||
userinfo = "user:password",
|
userinfo = "user:password",
|
||||||
user = "user",
|
user = "user",
|
||||||
password = "password",
|
password = "password",
|
||||||
path = "/path",
|
path = "/path;params",
|
||||||
params = "params",
|
|
||||||
query = "query",
|
query = "query",
|
||||||
fragment = "fragment"
|
fragment = "fragment"
|
||||||
}
|
}
|
||||||
@ -467,8 +452,7 @@ check_build_url {
|
|||||||
port = "port",
|
port = "port",
|
||||||
user = "user",
|
user = "user",
|
||||||
password = "password",
|
password = "password",
|
||||||
path = "/path",
|
path = "/path;params",
|
||||||
params = "params",
|
|
||||||
query = "query",
|
query = "query",
|
||||||
fragment = "fragment"
|
fragment = "fragment"
|
||||||
}
|
}
|
||||||
@ -478,8 +462,7 @@ check_build_url{
|
|||||||
host = "::FFFF:129.144.52.38",
|
host = "::FFFF:129.144.52.38",
|
||||||
port = "port",
|
port = "port",
|
||||||
user = "userinfo",
|
user = "userinfo",
|
||||||
path = "/path",
|
path = "/path;params",
|
||||||
params = "params",
|
|
||||||
query = "query",
|
query = "query",
|
||||||
fragment = "fragment"
|
fragment = "fragment"
|
||||||
}
|
}
|
||||||
@ -491,8 +474,7 @@ check_build_url{
|
|||||||
port = "port",
|
port = "port",
|
||||||
user = "user",
|
user = "user",
|
||||||
password = "password",
|
password = "password",
|
||||||
path = "/path",
|
path = "/path;params",
|
||||||
params = "params",
|
|
||||||
query = "query",
|
query = "query",
|
||||||
fragment = "fragment"
|
fragment = "fragment"
|
||||||
}
|
}
|
||||||
@ -503,8 +485,7 @@ check_build_url {
|
|||||||
host = "host",
|
host = "host",
|
||||||
user = "user",
|
user = "user",
|
||||||
password = "password",
|
password = "password",
|
||||||
path = "/path",
|
path = "/path;params",
|
||||||
params = "params",
|
|
||||||
query = "query",
|
query = "query",
|
||||||
fragment = "fragment"
|
fragment = "fragment"
|
||||||
}
|
}
|
||||||
@ -514,8 +495,7 @@ check_build_url {
|
|||||||
scheme = "scheme",
|
scheme = "scheme",
|
||||||
host = "host",
|
host = "host",
|
||||||
user = "user",
|
user = "user",
|
||||||
path = "/path",
|
path = "/path;params",
|
||||||
params = "params",
|
|
||||||
query = "query",
|
query = "query",
|
||||||
fragment = "fragment"
|
fragment = "fragment"
|
||||||
}
|
}
|
||||||
@ -524,8 +504,7 @@ check_build_url {
|
|||||||
url = "scheme://host/path;params?query#fragment",
|
url = "scheme://host/path;params?query#fragment",
|
||||||
scheme = "scheme",
|
scheme = "scheme",
|
||||||
host = "host",
|
host = "host",
|
||||||
path = "/path",
|
path = "/path;params",
|
||||||
params = "params",
|
|
||||||
query = "query",
|
query = "query",
|
||||||
fragment = "fragment"
|
fragment = "fragment"
|
||||||
}
|
}
|
||||||
@ -534,8 +513,7 @@ check_build_url {
|
|||||||
url = "scheme://host/path;params#fragment",
|
url = "scheme://host/path;params#fragment",
|
||||||
scheme = "scheme",
|
scheme = "scheme",
|
||||||
host = "host",
|
host = "host",
|
||||||
path = "/path",
|
path = "/path;params",
|
||||||
params = "params",
|
|
||||||
fragment = "fragment"
|
fragment = "fragment"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -573,9 +551,7 @@ check_build_url {
|
|||||||
user = "user",
|
user = "user",
|
||||||
userinfo = "not used",
|
userinfo = "not used",
|
||||||
password = "password",
|
password = "password",
|
||||||
path = "/path",
|
path = "/path;params",
|
||||||
params = "params",
|
|
||||||
query = "query",
|
|
||||||
fragment = "fragment"
|
fragment = "fragment"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -588,8 +564,7 @@ check_build_url {
|
|||||||
userinfo = "not used",
|
userinfo = "not used",
|
||||||
authority = "not used",
|
authority = "not used",
|
||||||
password = "password",
|
password = "password",
|
||||||
path = "/path",
|
path = "/path;params",
|
||||||
params = "params",
|
|
||||||
query = "query",
|
query = "query",
|
||||||
fragment = "fragment"
|
fragment = "fragment"
|
||||||
}
|
}
|
||||||
@ -601,8 +576,7 @@ check_build_url {
|
|||||||
port = "port",
|
port = "port",
|
||||||
userinfo = "user:password",
|
userinfo = "user:password",
|
||||||
authority = "not used",
|
authority = "not used",
|
||||||
path = "/path",
|
path = "/path;params",
|
||||||
params = "params",
|
|
||||||
query = "query",
|
query = "query",
|
||||||
fragment = "fragment"
|
fragment = "fragment"
|
||||||
}
|
}
|
||||||
@ -611,8 +585,7 @@ check_build_url {
|
|||||||
url = "scheme://user:password@host:port/path;params?query#fragment",
|
url = "scheme://user:password@host:port/path;params?query#fragment",
|
||||||
scheme = "scheme",
|
scheme = "scheme",
|
||||||
authority = "user:password@host:port",
|
authority = "user:password@host:port",
|
||||||
path = "/path",
|
path = "/path;params",
|
||||||
params = "params",
|
|
||||||
query = "query",
|
query = "query",
|
||||||
fragment = "fragment"
|
fragment = "fragment"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user