| 1 | import io |
| 2 | import os |
| 3 | import net.mbedtls |
| 4 | |
| 5 | fn main() { |
| 6 | mut client := mbedtls.new_ssl_conn(mbedtls.SSLConnectConfig{ |
| 7 | verify: os.resource_abs_path('cert/ca.crt') |
| 8 | cert: os.resource_abs_path('cert/client.crt') |
| 9 | cert_key: os.resource_abs_path('cert/client.key') |
| 10 | validate: true |
| 11 | })! |
| 12 | |
| 13 | client.dial('localhost', 8443)! |
| 14 | client.write_string('GET / HTTP/1.1\r\n\r\n')! |
| 15 | mut reader := io.new_buffered_reader(reader: client) |
| 16 | println(reader.read_line()!) |
| 17 | } |
| 18 |