|
2 | 2 |
|
3 | 3 | #include <libusockets.h>
|
4 | 4 |
|
| 5 | +#ifndef LIBUS_NO_SSL |
| 6 | +#define us_socket us_ssl_socket |
| 7 | +#define us_socket_context us_ssl_socket_context |
| 8 | +#define us_socket_write us_ssl_socket_write |
| 9 | +#define us_socket_close us_ssl_socket_close |
| 10 | +#define us_socket_shutdown us_ssl_socket_shutdown |
| 11 | +#define us_socket_context_on_end us_ssl_socket_context_on_end |
| 12 | +#define us_socket_context_on_open us_ssl_socket_context_on_open |
| 13 | +#define us_socket_context_on_close us_ssl_socket_context_on_close |
| 14 | +#define us_socket_context_on_writable us_ssl_socket_context_on_writable |
| 15 | +#define us_socket_context_on_data us_ssl_socket_context_on_data |
| 16 | +#define us_socket_context_on_timeout us_ssl_socket_context_on_timeout |
| 17 | +#define us_socket_ext us_ssl_socket_ext |
| 18 | +#define us_socket_context_ext us_ssl_socket_context_ext |
| 19 | +#define us_socket_get_context us_ssl_socket_get_context |
| 20 | +#define us_socket_context_listen us_ssl_socket_context_listen |
| 21 | +#define us_socket_timeout us_ssl_socket_timeout |
| 22 | +#define us_socket_context_connect us_ssl_socket_context_connect |
| 23 | +#endif |
| 24 | + |
5 | 25 | #include <stdio.h>
|
6 | 26 | #include <stdlib.h>
|
7 | 27 | #include <string.h>
|
@@ -103,7 +123,12 @@ int main(int argc, char **argv) {
|
103 | 123 | struct us_loop *loop = us_create_loop(1, on_wakeup, on_pre, on_post, 0);
|
104 | 124 |
|
105 | 125 | /* Create a socket context for HTTP */
|
| 126 | +#ifndef LIBUS_NO_SSL |
| 127 | + struct us_ssl_socket_context_options ssl_options = {}; |
| 128 | + struct us_socket_context *http_context = us_create_ssl_socket_context(loop, 0, ssl_options); |
| 129 | +#else |
106 | 130 | struct us_socket_context *http_context = us_create_socket_context(loop, 0);
|
| 131 | +#endif |
107 | 132 |
|
108 | 133 | /* Set up event handlers */
|
109 | 134 | us_socket_context_on_open(http_context, on_http_socket_open);
|
|
0 commit comments