Skip to content

Commit

Permalink
Fix server-side request body
Browse files Browse the repository at this point in the history
  • Loading branch information
quinnj committed Jun 13, 2024
1 parent 7b9ca24 commit 291def1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/server.jl
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ function c_on_request_body(stream, data::Ptr{aws_byte_cursor}, conn_ptr)
body = conn.current_request.body
try
@assert hasroom(body, bc.len) "body buffer too small"
unsafe_write(conn.current_request.body, bc.ptr, bc.len)
unsafe_write(body, bc.ptr, bc.len)
return Cint(0)
catch
@error "failed to write request body" exception=(exception, Base.catch_stack())
Expand All @@ -215,6 +215,7 @@ const on_request_done = Ref{Ptr{Cvoid}}(C_NULL)

function c_on_request_done(stream, conn_ptr)
conn = unsafe_pointer_to_objref(conn_ptr)
conn.current_request.body = take!(conn.current_request.body)
try
resp = conn.f(conn.current_request)::Response
aws_resp = conn.current_response = aws_http_message_new_response(conn.allocator)
Expand Down

0 comments on commit 291def1

Please sign in to comment.