Use select in TLCP client

Example of `tlcp_client`

```
$ gmssl tlcp_client -host ebssec.boc.cn
Connection established!
GET / HTTP/1.1[enter]
Host: localhost[enter]
[enter]
[enter]
```
This commit is contained in:
Zhi Guan
2022-07-29 11:59:25 +08:00
parent 5dadb639a8
commit 6a5eef05d5
3 changed files with 33 additions and 17 deletions

View File

@@ -595,7 +595,7 @@ int tlcp_do_connect(TLS_CONNECT *conn)
tls_send_alert(conn, TLS_alert_decrypt_error);
goto end;
}
tls_trace("Connection established!\n");
printf("Connection established!\n");
conn->protocol = TLS_protocol_tlcp;

View File

@@ -1721,8 +1721,6 @@ int tls_send(TLS_CONNECT *conn, const uint8_t *in, size_t inlen, size_t *sentlen
tls_trace("send ApplicationData\n");
format_bytes(stderr, 0, 0, "tls_send: payload", in, inlen);
if (tls_record_set_type(record, TLS_record_application_data) != 1
|| tls_record_set_protocol(record, conn->protocol) != 1
|| tls_record_set_length(record, inlen) != 1) {