Skip to content

Commit

Permalink
Merge pull request #69 from JuliaWeb/tan/misc
Browse files Browse the repository at this point in the history
julia 1.0 compatibility
  • Loading branch information
tanmaykm authored Sep 4, 2018
2 parents e61c2c8 + f170878 commit 550f4b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ os:
julia:
- 0.6
- 0.7
- 1.0
- nightly
matrix:
fast_finish: true
Expand Down
14 changes: 7 additions & 7 deletions src/http_rpc_server.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ function parsepostdata(req, data_dict, multipart_boundary)
Lbound = length(boundary)
Ldata = length(data)

boundbytes = convert(Vector{UInt8}, boundary)
boundbytes_end = convert(Vector{UInt8}, boundary_end)
boundbytes = convert(Vector{UInt8}, codeunits(boundary))
boundbytes_end = convert(Vector{UInt8}, codeunits(boundary_end))

boundloc = searcharr(data, boundbytes, 1)
endpos = startpos = last(boundloc) + 1
Expand Down Expand Up @@ -162,27 +162,27 @@ function http_handler(apis::Channel{APIInvoker{T,F}}, preproc::Function, req::HT
res = HTTP.Response(500)

try
comps = split(getfield(req, :target), '?', limit=2, keep=false)
comps = Compat.split(getfield(req, :target), '?', limit=2, keepempty=false)
if isempty(comps)
res = HTTP.Response(404)
else
res = preproc(req)
if res === nothing
comps = split(getfield(req, :target), '?', limit=2, keep=false)
path = shift!(comps)
comps = Compat.split(getfield(req, :target), '?', limit=2, keepempty=false)
path = popfirst!(comps)
data_dict = isempty(comps) ? Dict{String,String}() : HTTP.queryparams(comps[1])
multipart_boundary = get_multipart_form_boundary(req)
if multipart_boundary === nothing
data_dict = parsepostdata(req, data_dict)
else
data_dict = parsepostdata(req, data_dict, multipart_boundary)
end
args = map(String, split(path, '/', keep=false))
args = map(String, Compat.split(path, '/', keepempty=false))

if isempty(args) || !isvalidcmd(args[1])
res = HTTP.Response(404)
else
cmd = shift!(args)
cmd = popfirst!(args)
@static if isdefined(Base, Symbol("@info"))
@info("waiting for a handler")
else
Expand Down

0 comments on commit 550f4b1

Please sign in to comment.