diff --git a/src/HTTP2.jl b/src/HTTP2.jl index 3b0744a..b707bef 100644 --- a/src/HTTP2.jl +++ b/src/HTTP2.jl @@ -245,6 +245,7 @@ mutable struct RequestContext request_body::Any body_byte_cursor::aws_byte_cursor response::Response + response_headers::Headers temp_response_body::Any gzip_decompressing::Bool error_response_body::Union{Nothing, Vector{UInt8}} @@ -259,7 +260,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, 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, Headers(), nothing, false, nothing, Ref{aws_http_make_request_options}(), C_NULL, C_NULL, args...) end struct StatusError <: Exception diff --git a/src/client.jl b/src/client.jl index 6b22223..2b60b41 100644 --- a/src/client.jl +++ b/src/client.jl @@ -192,7 +192,7 @@ const on_response_headers = Ref{Ptr{Cvoid}}(C_NULL) function c_on_response_headers(stream, header_block, header_array::Ptr{aws_http_header}, num_headers, ctx_ptr) ctx = unsafe_pointer_to_objref(ctx_ptr) - headers = ctx.response.headers + headers = ctx.response_headers oldlen = length(headers) resize!(headers, oldlen + num_headers) for i = 1:num_headers @@ -211,6 +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 aws_http_stream_get_incoming_response_status(stream, ref) ctx.response.status = ref[] if ctx.status_exception && ctx.response.status >= 299