在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:JuliaWeb/HTTP.jl开源软件地址:https://github.com/JuliaWeb/HTTP.jl开源编程语言:Julia 99.5%开源软件介绍:HTTPHTTP client and server functionality for Julia
InstallationThe package can be installed with Julia's package manager,
either by using the Pkg REPL mode (press
or by using Pkg functions julia> using Pkg; Pkg.add("HTTP") Project StatusThe package has matured and is used in many production systems. But as with all open-source software, please try it out and report your experience. The package is tested against current Julia LTS (1.6), and current master on Linux, macOS, and Windows. Contributing and QuestionsContributions are very welcome, as are feature requests and suggestions. Please open an issue if you encounter any problems or would just like to ask a question. Client Examples
r = HTTP.request("GET", "http://httpbin.org/ip")
println(r.status)
println(String(r.body))
HTTP.open(:GET, "https://tinyurl.com/bach-cello-suite-1-ogg") do http
open(`vlc -q --play-and-exit --intf dummy -`, "w") do vlc
write(vlc, http)
end
end Server ExamplesThe server will start listening on 127.0.0.1:8081 by default. using HTTP
HTTP.listen() do http::HTTP.Stream
@show http.message
@show HTTP.header(http, "Content-Type")
while !eof(http)
println("body data: ", String(readavailable(http)))
end
HTTP.setstatus(http, 404)
HTTP.setheader(http, "Foo-Header" => "bar")
HTTP.startwrite(http)
write(http, "response body")
write(http, "more response body")
end using HTTP
HTTP.serve() do request::HTTP.Request
@show request
@show request.method
@show HTTP.header(request, "Content-Type")
@show request.body
try
return HTTP.Response("Hello")
catch e
return HTTP.Response(404, "Error: $e")
end
end WebSocket Examplesjulia> @async HTTP.WebSockets.listen("127.0.0.1", 8081) do ws
for msg in ws
send(ws, msg)
end
end
julia> HTTP.WebSockets.open("ws://127.0.0.1:8081") do ws
send(ws, "Hello")
s = receive(ws)
println(x)
end;
Hello |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论