Skip to content

Commit

Permalink
Try yet another workaroudn
Browse files Browse the repository at this point in the history
  • Loading branch information
quinnj committed Sep 23, 2024
1 parent ea162b1 commit 3f81017
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions src/HTTP2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,11 @@ function getclient(key::Tuple{SubString{String}, SubString{String}, UInt32, Bool
end
end

struct Header2
name::String
value::String
end

mutable struct RequestContext
client::Client
retry_token::Ptr{aws_retry_token}
Expand All @@ -245,7 +250,7 @@ mutable struct RequestContext
request_body::Any
body_byte_cursor::aws_byte_cursor
response::Response
response_headers::Headers
response_headers::Vector{Header2}
temp_response_body::Any
gzip_decompressing::Bool
error_response_body::Union{Nothing, Vector{UInt8}}
Expand All @@ -260,7 +265,7 @@ mutable struct RequestContext
end

function RequestContext(client, request, response, args...)
return RequestContext(client, C_NULL, false, Threads.Event(), nothing, request, nothing, aws_byte_cursor(0, C_NULL), response, Headers(), nothing, false, nothing, Ref{aws_http_make_request_options}(), C_NULL, C_NULL, args...)
return RequestContext(client, C_NULL, false, Threads.Event(), nothing, request, nothing, aws_byte_cursor(0, C_NULL), response, Header2[], nothing, false, nothing, Ref{aws_http_make_request_options}(), C_NULL, C_NULL, args...)
end

struct StatusError <: Exception
Expand Down
4 changes: 2 additions & 2 deletions src/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ function c_on_response_headers(stream, header_block, header_array::Ptr{aws_http_
header = unsafe_load(header_array, i)
name = unsafe_string(header.name.ptr, header.name.len)
value = unsafe_string(header.value.ptr, header.value.len)
headers[oldlen + i] = name => value
headers[oldlen + i] = Header2(name, value)
end
return Cint(0)
end
Expand All @@ -211,7 +211,7 @@ const on_response_header_block_done = Ref{Ptr{Cvoid}}(C_NULL)
function c_on_response_header_block_done(stream, header_block, ctx_ptr)
ctx = unsafe_pointer_to_objref(ctx_ptr)
ref = Ref{Cint}()
ctx.response.headers = ctx.response_headers
ctx.response.headers = [x.name => x.value for x in ctx.response_headers]
aws_http_stream_get_incoming_response_status(stream, ref)
ctx.response.status = ref[]
if ctx.status_exception && ctx.response.status >= 299
Expand Down

0 comments on commit 3f81017

Please sign in to comment.