8000 Fix julia 0.6 deprecations (#128) · JuliaWeb/HttpServer.jl@c75ea71 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Sep 4, 2019. It is now read-only.

Commit c75ea71

Browse files
davidanthoffararslan
authored andcommitted
Fix julia 0.6 deprecations (#128)
1 parent 9be927f commit c75ea71

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

examples/https.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
rel(p::String) = joinpath(dirname(@__FILE__), p)
44
if !isfile(rel("keys/server.crt"))
5-
@unix_only begin
5+
@static if is_unix()
66
run(`mkdir -p $(rel("keys"))`)
77
run(`openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout
88
$(rel("keys/server.key")) -out $(rel("keys/server.crt"))`)

src/HttpServer.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ handler.events["foo"] = (bar) "Hello \$bar"
9090
HttpServer.event(server, "foo", "Julia")
9191
```
9292
"""
93-
immutable HttpHandler
93+
struct HttpHandler
9494
handle::Function
9595
sock::Base.TCPServer
9696
events::Dict
@@ -106,14 +106,14 @@ handle(handler::HttpHandler, req::Request, res::Response) = handler.handle(req,
106106
the connection socket. `Client.parser` will store a `ClientParser` to handle
107107
all HTTP parsing for the connection lifecycle.
108108
"""
109-
type Client{T<:IO}
109+
mutable struct Client{T<:IO}
110110
id::Int
111111
sock::T
112112
parser::ClientParser
113113

114114
Client(id::Int,sock::T) = new(id,sock)
115115
end
116-
Client{T<:IO}(id::Int,sock::T) = Client{T}(id,sock)
116+
Client(id::Int,sock::T) where {T <: IO} = Client{T}(id,sock)
117117

118118
""" `WebSocketInterface` defines the abstract protocol for a WebSocketHandler.
119119
@@ -147,7 +147,7 @@ end
147147
* Instantiate with just a `WebSocketInterface` to only serve websockets
148148
requests and `404` all others.
149149
"""
150-
immutable Server
150+
struct Server
151151
http::HttpHandler
152152
websock::Union{Void, WebSocketInterface}
153153
end

src/RequestParser.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ end
118118

119119
default_complete_cb(r::Request) = nothing
120120

121-
type RequestParserState
121+
mutable struct RequestParserState
122122
request::Request
123123
complete_cb::Function
124124
num_fields::Int
@@ -133,7 +133,7 @@ pd(p::Ptr{Parser}) = (unsafe_load(p).data)::RequestParserState
133133
# `ClientParser` wraps our `HttpParser`
134134
# Constructed with `on_message_complete` function.
135135
#
136-
immutable ClientParser
136+
struct ClientParser
137137
parser::Parser
138138
settings::ParserSettings
139139

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ facts("HttpServer utility functions:") do
77
response = Response(200, "Hello World!")
88
buf = IOBuffer();
99
HttpServer.write(buf, response)
10-
response_string = takebuf_string(buf)
10+
response_string = String(take!(buf))
1111
vals = split(response_string, "\r\n")
1212
grep(a::Array, k::AbstractString) = filter(x -> ismatch(Regex(k), x), a)[1]
1313
@fact grep(vals, "HTTP") --> "HTTP/1.1 200 OK "

0 commit comments

Comments
 (0)
0