Skip to content

Commit 1d00acc

Browse files
authored
set server name for TLS (#9)
* enable TLS SNI * update changelog
1 parent 2e5aa6a commit 1d00acc

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
- ~FTP over TLS support ([#3](https://github.com/matth-x/MicroOcppMongoose/pull/3))~ (see [#5](https://github.com/matth-x/MicroOcppMongoose/pull/5))
1212
- OCPP 2.0.1 compatibility ([#6](https://github.com/matth-x/MicroOcppMongoose/pull/6))
13+
- Send host name in TLS handshake ([#9](https://github.com/matth-x/MicroOcppMongoose/pull/9))
1314

1415
### Removed
1516

src/MicroOcppMongooseClient.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,10 @@ void ws_cb(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
468468
//yes, disabled
469469
ca_string = nullptr;
470470
}
471-
struct mg_tls_opts opts = {.ca = ca_string};
471+
struct mg_tls_opts opts;
472+
memset(&opts, 0, sizeof(struct mg_tls_opts));
473+
opts.ca = ca_string;
474+
opts.srvname = mg_url_host(osock->getUrl());
472475
mg_tls_init(c, &opts);
473476
} else {
474477
MO_DBG_WARN("Insecure connection (WS)");

0 commit comments

Comments
 (0)