Skip to content

Commit

Permalink
refactor(http): split into 2 modules: client and server
Browse files Browse the repository at this point in the history
```
local http = require 'eco.http.server'
```

or

```
local http = require 'eco.http.client'
```

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
  • Loading branch information
zhaojh329 committed Sep 16, 2023
1 parent 958ab7c commit 677cecf
Show file tree
Hide file tree
Showing 9 changed files with 401 additions and 369 deletions.
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,11 @@ install(

install(
FILES time.lua sys.lua file.lua bufio.lua dns.lua socket.lua
url.lua http.lua websocket.lua sync.lua
nl.lua genl.lua ip.lua nl80211.lua
websocket.lua sync.lua nl.lua genl.lua ip.lua nl80211.lua
DESTINATION ${LUA_INSTALL_PREFIX}/eco
)

install(
FILES http/client.lua http/server.lua http/url.lua
DESTINATION ${LUA_INSTALL_PREFIX}/eco/http
)
2 changes: 1 addition & 1 deletion examples/network/http.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env eco

local http = require 'eco.http'
local http = require 'eco.http.client'

local resp, err = http.request('https://127.0.0.1:8080', nil, { insecure = true })
if not resp then
Expand Down
2 changes: 1 addition & 1 deletion examples/network/http_server.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env eco

local http = require 'eco.http'
local http = require 'eco.http.server'
local log = require 'eco.log'

log.set_level(log.DEBUG)
Expand Down
2 changes: 1 addition & 1 deletion examples/network/websocket_server.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env eco

local websocket = require 'eco.websocket'
local http = require 'eco.http'
local http = require 'eco.http.server'

local page =
[[
Expand Down

0 comments on commit 677cecf

Please sign in to comment.