Skip to content

Commit 4257a38

Browse files
authored
Merge pull request #72 from rssdev10/master
http_rpc_server: parsepostdata: fixed julia 1.0 issues
2 parents 9811686 + b62be0c commit 4257a38

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/http_rpc_server.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ function parsepostdata(req, query)
2121
req_body = getfield(req, :body)
2222

2323
if !isempty(req_body)
24-
idx = findfirst(req_body, UInt8('\0'))
25-
idx = (idx == 0) ? endof(req_body) : (idx - 1)
24+
idx = findfirst(isequal(UInt8('\0'), req_body))
25+
idx = (idx == nothing) ? lastindex(req_body) : (idx - 1)
2626
post_data = (idx == 0) ? String(req_body) : String(req_body[1:(idx-1)])
2727
end
28-
28+
2929
('=' in post_data) || (return query)
3030
merge(query, HTTP.queryparams(post_data))
3131
end
@@ -156,7 +156,7 @@ end
156156
function http_handler(apis::Channel{APIInvoker{T,F}}, preproc::Function, req::HTTP.Request) where {T,F}
157157
@info("processing", target=getfield(req, :target))
158158
res = HTTP.Response(500)
159-
159+
160160
try
161161
comps = split(getfield(req, :target), '?', limit=2, keepempty=false)
162162
if isempty(comps)

0 commit comments

Comments
 (0)