Skip to content

Commit

Permalink
Add 'connection: close' note
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelstoer committed Apr 21, 2017
1 parent 9d11543 commit ef1654f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions docs/en/modules/net.md
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,12 @@ Otherwise, all connection errors (with normal close) passed to disconnection eve
```lua
srv = net.createConnection(net.TCP, 0)
srv:on("receive", function(sck, c) print(c) end)
-- Wait for connection before sending.
srv:on("connection", function(sck, c)
-- Wait for connection before sending.
sck:send("GET /get HTTP/1.1\r\nHost: httpbin.org\r\nConnection: keep-alive\r\nAccept: */*\r\n\r\n")
-- 'Connection: close' rather than 'Connection: keep-alive' to have server
-- initiate a close of the connection after final response (frees memory
-- earlier here), http://bit.ly/2pkOrsi

This comment has been minimized.

Copy link
@nwf

nwf Apr 22, 2017

Member

Is there any reason not to link directly to https://tools.ietf.org/html/rfc7230#section-6.6 rather than to bit.ly?

This comment has been minimized.

Copy link
@marcelstoer

marcelstoer Apr 22, 2017

Author Member

No, I'll change it.

sck:send("GET /get HTTP/1.1\r\nHost: httpbin.org\r\nConnection: close\r\nAccept: */*\r\n\r\n")
end)
srv:connect(80,"httpbin.org")
```
Expand Down

0 comments on commit ef1654f

Please sign in to comment.