Skip to content

Commit 7744afd

Browse files
authored
Merge pull request #73 from asprionj/httpfix
removing http patch using HTTP 0.8.2 with reuse_limit=0
2 parents 5258d09 + bcd37e1 commit 7744afd

File tree

4 files changed

+14
-149
lines changed

4 files changed

+14
-149
lines changed

Project.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "LiveServer"
22
uuid = "16fef848-5104-11e9-1b77-fb7a48bbb589"
33
authors = ["Jonas Asprion <jonas.asprion@gmx.ch", "Thibaut Lienart <tlienart@me.com>"]
4-
version = "0.2.1"
4+
version = "0.3.0"
55

66
[deps]
77
Crayons = "a8cc5b0e-0ffa-5ad4-8c14-923d3ee1735f"
@@ -12,7 +12,7 @@ Sockets = "6462fe0b-24de-5631-8697-dd941f90decc"
1212
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1313

1414
[compat]
15-
julia = "^1.0.0"
16-
Documenter = "^0.22.0"
1715
Crayons = "^4.0.0"
16+
Documenter = "^0.22.0"
1817
HTTP = "^0.8.0"
18+
julia = "^1.0.0"

src/LiveServer.jl

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,34 +11,29 @@ export serve, servedocs
1111
# Environment variables
1212
#
1313

14-
# see `client.html`
14+
"""Script to insert on a page for live reload, see `client.html`."""
1515
const BROWSER_RELOAD_SCRIPT = read(joinpath(dirname(pathof(LiveServer)), "client.html"), String)
16-
# whether to display messages while serving or not, see `verbose()`
16+
17+
"""Whether to display messages while serving or not, see [`verbose`](@ref)."""
1718
const VERBOSE = Ref{Bool}(false)
18-
# the folder to watch, either the current one or a specified one.4
19+
20+
"""The folder to watch, either the current one or a specified one."""
1921
const CONTENT_DIR = Ref{String}("")
20-
# list of files being tracked by WebSocket connections, interrupt catched in ws handler?
22+
23+
"""List of files being tracked with WebSocket connections."""
2124
const WS_VIEWERS = Dict{String,Vector{HTTP.WebSockets.WebSocket}}()
22-
# keep track of whether an interruption happened while processing a websocket
23-
const WS_INTERRUPT = Base.Ref{Bool}(false)
2425

25-
#
26-
# HTTP patch
27-
#
28-
include("http_patch.jl")
26+
"""Keep track of whether an interruption happened while processing a websocket."""
27+
const WS_INTERRUPT = Base.Ref{Bool}(false)
2928

3029
#
31-
# Core
30+
# Functions
3231
#
3332

3433
include("mimetypes.jl")
3534
include("file_watching.jl")
3635
include("server.jl")
3736

38-
#
39-
# Utilities
40-
#
41-
4237
include("utils.jl")
4338

4439
end # module

src/http_patch.jl

Lines changed: 0 additions & 131 deletions
This file was deleted.

src/server.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ function serve(fw::FileWatcher=SimpleWatcher(file_changed_callback);
216216
println("✓ LiveServer listening on http://localhost:$port/ ...\n (use CTRL+C to shut down)")
217217
@async HTTP.listen(Sockets.localhost, port;
218218
server=server, readtimeout=0, reuse_limit=0) do http::HTTP.Stream
219+
# reuse_limit=0 ensures that there won't be an error if killing and restarting the server.
219220
if HTTP.WebSockets.is_upgrade(http.message)
220221
# upgrade to websocket
221222
ws = ws_upgrade(http)

0 commit comments

Comments
 (0)