uclient-fetch: set server_name of the ssl context to support SNI
[project/uclient.git] / uclient-http.c
index 7e930d7..4300d05 100644 (file)
@@ -547,7 +547,7 @@ uclient_http_send_headers(struct uclient_http *uh)
                url->location, url->host);
 
        blobmsg_for_each_attr(cur, uh->headers.head, rem)
-               ustream_printf(uh->us, "%s: %s\n", blobmsg_name(cur), (char *) blobmsg_data(cur));
+               ustream_printf(uh->us, "%s: %s\r\n", blobmsg_name(cur), (char *) blobmsg_data(cur));
 
        if (uh->req_type == REQ_POST || uh->req_type == REQ_PUT)
                ustream_printf(uh->us, "Transfer-Encoding: chunked\r\n");
@@ -826,6 +826,7 @@ static int uclient_setup_https(struct uclient_http *uh)
        uh->ussl.notify_error = uclient_ssl_notify_error;
        uh->ussl.notify_verify_error = uclient_ssl_notify_verify_error;
        uh->ussl.notify_connected = uclient_ssl_notify_connected;
+       uh->ussl.server_name = uh->uc.url->host;
        uh->ssl_ops->init(&uh->ussl, &uh->ufd.stream, uh->ssl_ctx, false);
        uh->ssl_ops->set_peer_cn(&uh->ussl, uh->uc.url->host);