Skip to content

Commit

Permalink
Merge pull request #73 from asprionj/httpfix
Browse files Browse the repository at this point in the history
removing http patch using HTTP 0.8.2 with reuse_limit=0
  • Loading branch information
tlienart authored Jun 3, 2019
2 parents 5258d09 + bcd37e1 commit 7744afd
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 149 deletions.
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "LiveServer"
uuid = "16fef848-5104-11e9-1b77-fb7a48bbb589"
authors = ["Jonas Asprion <[email protected]", "Thibaut Lienart <[email protected]>"]
version = "0.2.1"
version = "0.3.0"

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

[compat]
julia = "^1.0.0"
Documenter = "^0.22.0"
Crayons = "^4.0.0"
Documenter = "^0.22.0"
HTTP = "^0.8.0"
julia = "^1.0.0"
25 changes: 10 additions & 15 deletions src/LiveServer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,29 @@ export serve, servedocs
# Environment variables
#

# see `client.html`
"""Script to insert on a page for live reload, see `client.html`."""
const BROWSER_RELOAD_SCRIPT = read(joinpath(dirname(pathof(LiveServer)), "client.html"), String)
# whether to display messages while serving or not, see `verbose()`

"""Whether to display messages while serving or not, see [`verbose`](@ref)."""
const VERBOSE = Ref{Bool}(false)
# the folder to watch, either the current one or a specified one.4

"""The folder to watch, either the current one or a specified one."""
const CONTENT_DIR = Ref{String}("")
# list of files being tracked by WebSocket connections, interrupt catched in ws handler?

"""List of files being tracked with WebSocket connections."""
const WS_VIEWERS = Dict{String,Vector{HTTP.WebSockets.WebSocket}}()
# keep track of whether an interruption happened while processing a websocket
const WS_INTERRUPT = Base.Ref{Bool}(false)

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

#
# Core
# Functions
#

include("mimetypes.jl")
include("file_watching.jl")
include("server.jl")

#
# Utilities
#

include("utils.jl")

end # module
131 changes: 0 additions & 131 deletions src/http_patch.jl

This file was deleted.

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

0 comments on commit 7744afd

Please sign in to comment.