-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathstream.hpp
More file actions
46 lines (33 loc) · 1.3 KB
/
stream.hpp
File metadata and controls
46 lines (33 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#pragma once
#ifdef EMSCRIPTEN
# include <git2/sys/transport.h>
# include "libgit2_internals.hpp"
# include "response.hpp"
# include "subtransport.hpp"
// A stream represents a single http/https request.
struct wasm_http_stream
{
wasm_http_stream(wasm_http_subtransport* subtransport, http_service service);
// Return true if URL is changed.
bool ensure_final_url(const std::string final_url);
// Return true if URL is changed from http to https.
bool ensure_https();
// Return full URL of request, which may have been modified to use CORS proxy.
std::string get_full_url();
git_smart_subtransport_stream m_parent;
wasm_http_subtransport* m_subtransport; // Not owned, needed for credentials, etc.
http_service m_service;
std::string m_unconverted_url;
int m_request_index;
wasm_http_response m_response;
};
void wasm_http_stream_free(git_smart_subtransport_stream* s);
int wasm_http_stream_read(git_smart_subtransport_stream* s, char* buffer, size_t buffer_size, size_t* bytes_read);
int wasm_http_stream_read_response(
git_smart_subtransport_stream* s,
char* buffer,
size_t buffer_size,
size_t* bytes_read
);
int wasm_http_stream_write(git_smart_subtransport_stream* s, const char* buffer, size_t buffer_size);
#endif // EMSCRIPTEN