Skip to content

Commit f0d1156

Browse files
committed
compat for 0.7.0-DEV.4616
1 parent f732227 commit f0d1156

8 files changed

+21
-17
lines changed

src/Parsers.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ else
211211
Find `\\n` in `bytes`
212212
"""
213213
find_end_of_line(bytes::AbstractVector{UInt8}) =
214-
(i = findfirst(equalto(UInt8('\n')), bytes)) == nothing ? 0 : i
214+
(i = findfirst(isequal(UInt8('\n')), bytes)) == nothing ? 0 : i
215215
end
216216

217217
"""

src/RetryRequest.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function request(::Type{RetryLayer{Next}}, url, req, body;
3333
check=(s,ex)->begin
3434
retry = isrecoverable(ex, req, retry_non_idempotent)
3535
if retry
36-
@debug 1 "🔄 Retry $ex: $(sprint(showcompact, req))"
36+
@debug 1 "🔄 Retry $ex: $(sprintcompact(req))"
3737
reset!(req.response)
3838
else
3939
@debug 1 "🚷 No Retry: $(no_retry_reason(ex, req))"

src/StreamRequest.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ using ..Messages
66
using ..Streams
77
import ..ConnectionPool
88
using ..MessageRequest
9-
import ..@debug, ..DEBUG_LEVEL, ..printlncompact
9+
import ..@debug, ..DEBUG_LEVEL, ..printlncompact, ..sprintcompact
1010

1111
"""
1212
request(StreamLayer, ::IO, ::Request, body) -> HTTP.Response
@@ -37,7 +37,7 @@ function request(::Type{StreamLayer}, io::IO, request::Request, body;
3737
if verbose == 2
3838
println(request)
3939
if iofunction == nothing && request.body === body_is_a_stream
40-
println("$(typeof(request)).body: $(sprint(showcompact, body))")
40+
println("$(typeof(request)).body: $(sprintcompact(body))")
4141
end
4242
end
4343

src/Streams.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ end
251251
else
252252

253253
find_delim(bytes, d::UInt8) =
254-
(i = findfirst(equalto(d), bytes)) == nothing ? 0 : i
254+
(i = findfirst(isequal(d), bytes)) == nothing ? 0 : i
255255

256256
function Base.readuntil(http::Stream, delim::UInt8; keep::Bool=false)
257257
bytes = readuntil(http, bytes->find_delim(bytes, delim))

src/compat.jl

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
v06 = v"0.6.2"
3-
v07 = v"0.7.0-DEV.4456"
3+
v07 = v"0.7.0-DEV.4616"
44

55
supported() = VERSION >= v07 ||
66
(VERSION >= v06 && VERSION < v"0.7.0-DEV")
@@ -26,9 +26,11 @@ __init__() = supported() || compat_warn()
2626

2727
compat_stdout() = stdout
2828

29-
compat_search(s::AbstractString, c::Char) = Base.findfirst(equalto(c), s)
29+
compat_search(s::AbstractString, c::Char) = Base.findfirst(isequal(c), s)
3030
using Sockets
3131

32+
sprintcompact(x) = sprint(show, x; context=:compact => true)
33+
3234
else
3335

3436
supported() || compat_warn()
@@ -68,6 +70,8 @@ else
6870
getsockname, getaddrinfo, connect, listen, DNSError
6971
end))
7072
using .Sockets
73+
74+
sprintcompact(x) = sprint(showcompact, x)
7175
end
7276

7377
#https://github.com/JuliaWeb/MbedTLS.jl/issues/122

src/debug.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ end
1616

1717
macro debugshort(n::Int, s)
1818
DEBUG_LEVEL >= n ? :(println("DEBUG: ", taskid(), " ",
19-
sprint(showcompact, $(esc(s))))) :
19+
sprintcompact($(esc(s))))) :
2020
:()
2121
end
2222

23-
printlncompact(x) = println(sprint(showcompact, x))
23+
printlncompact(x) = println(sprintcompact(x))
2424

2525

2626
@noinline function precondition_error(msg, frame)

src/sniff.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,8 @@ const LITTLE_A = UInt8('a')
284284
const LITTLE_S = UInt8('s')
285285
const PERIOD = UInt8('.')
286286

287-
@static if VERSION >= v"0.7.0-DEV.4370"
288-
const REF = Vector{Ptr{UInt8}}(uninitialized, 1)
287+
@static if VERSION >= v"0.7.0-DEV.4616"
288+
const REF = Vector{Ptr{UInt8}}(undef, 1)
289289
else
290290
const REF = Vector{Ptr{UInt8}}(1)
291291
end

test/loopback.jl

+6-6
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,14 @@ function Base.unsafe_write(lb::Loopback, p::Ptr{UInt8}, n::UInt)
112112

113113
on_headers(lb) do req
114114

115-
println("📡 $(sprint(showcompact, req))")
116-
push!(server_events, "Request: $(sprint(showcompact, req))")
115+
println("📡 $(HTTP.sprintcompact(req))")
116+
push!(server_events, "Request: $(HTTP.sprintcompact(req))")
117117

118118
if req.target == "/abort"
119119
reset(lb)
120120
response = HTTP.Response(403, ["Connection" => "close",
121121
"Content-Length" => 0]; request=req)
122-
push!(server_events, "Response: $(sprint(showcompact, response))")
122+
push!(server_events, "Response: $(HTTP.sprintcompact(response))")
123123
write(lb.io, response)
124124
end
125125
end
@@ -130,18 +130,18 @@ function Base.unsafe_write(lb::Loopback, p::Ptr{UInt8}, n::UInt)
130130
response = HTTP.Response(200, ["Content-Length" => l],
131131
body = req.body; request=req)
132132
if req.target == "/echo"
133-
push!(server_events, "Response: $(sprint(showcompact, response))")
133+
push!(server_events, "Response: $(HTTP.sprintcompact(response))")
134134
write(lb.io, response)
135135
elseif (m = match(r"^/delay([0-9]*)$", req.target)) != nothing
136136
t = parse(Int, first(m.captures))
137137
sleep(t/10)
138-
push!(server_events, "Response: $(sprint(showcompact, response))")
138+
push!(server_events, "Response: $(HTTP.sprintcompact(response))")
139139
write(lb.io, response)
140140
else
141141
response = HTTP.Response(403,
142142
["Connection" => "close",
143143
"Content-Length" => 0]; request=req)
144-
push!(server_events, "Response: $(sprint(showcompact, response))")
144+
push!(server_events, "Response: $(HTTP.sprintcompact(response))")
145145
write(lb.io, response)
146146
end
147147
end

0 commit comments

Comments
 (0)