Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
64 lines (46 loc) · 1.47 KB

File metadata and controls

64 lines (46 loc) · 1.47 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef _HTTPS_CLIENT_H_
#define _HTTPS_CLIENT_H_
#include <curl/curl.h>
#include "options.h"
#include "stat.h"
enum {
HTTPS_SOCKET_LIMIT = 12,
HTTPS_CONNECTION_LIMIT = 8,
};
// Callback type for receiving data when a transfer finishes.
typedef void (*https_response_cb)(void *data, char *buf, size_t buflen);
// Internal: Holds state on an individual transfer.
struct https_fetch_ctx {
CURL *curl;
char curl_errbuf[CURL_ERROR_SIZE];
uint16_t id;
https_response_cb cb;
void *cb_data;
char *buf;
size_t buflen;
struct https_fetch_ctx *next;
};
// Holds state on the whole multiplexed CURL machine.
typedef struct {
struct ev_loop *loop;
CURLM *curlm;
struct curl_slist *header_list;
struct https_fetch_ctx *fetches;
ev_timer timer;
ev_io io_events[HTTPS_SOCKET_LIMIT];
int connections;
options_t *opt;
stat_t *stat;
ev_timer reset_timer;
} https_client_t;
void https_client_init(https_client_t *c, options_t *opt,
stat_t *stat, struct ev_loop *loop);
void https_client_fetch(https_client_t *c, const char *url,
const char* postdata, size_t postdata_len,
struct curl_slist *resolv, uint16_t id,
https_response_cb cb, void *data);
// Used to reset state of libcurl because streaming connections + IP changes
// seem to cause curl to flip out.
void https_client_reset(https_client_t *c);
void https_client_cleanup(https_client_t *c);
#endif // _HTTPS_CLIENT_H_
Morty Proxy This is a proxified and sanitized view of the page, visit original site.