Skip to content

Commit 6e4cd3c

Browse files
committed
Fix handling sequence of libgit2 read calls
1 parent e10933f commit 6e4cd3c

1 file changed

Lines changed: 7 additions & 13 deletions

File tree

‎src/wasm/stream.cpp‎

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -337,20 +337,14 @@ static int read(wasm_http_stream* stream, read_buffer_t& read_buffer, bool is_re
337337
}
338338
else
339339
{
340-
if (stream->m_request_index != -1)
341-
{
342-
git_error_set(
343-
GIT_ERROR_HTTP,
344-
"read called with pending request to %s",
345-
stream->m_unconverted_url.c_str()
346-
);
347-
return -1;
348-
}
349-
350-
if (create_request(stream, stream->m_service.m_response_type.c_str()) < 0)
340+
if (stream->m_request_index == -1)
351341
{
352-
convert_js_to_git_error(stream);
353-
return -1;
342+
// Send http(s) request if have not already done so.
343+
if (create_request(stream, stream->m_service.m_response_type.c_str()) < 0)
344+
{
345+
convert_js_to_git_error(stream);
346+
return -1;
347+
}
354348
}
355349
}
356350

0 commit comments

Comments
 (0)