From 6a56855284178fa5b0046855ca1ea701459c062e Mon Sep 17 00:00:00 2001 From: Andy Green Date: Sat, 2 Nov 2019 10:11:20 +0000 Subject: [PATCH] minimal client http: add lws_get_peer_simple example --- .../minimal-http-client/minimal-http-client.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/minimal-examples/http-client/minimal-http-client/minimal-http-client.c b/minimal-examples/http-client/minimal-http-client/minimal-http-client.c index 66081b1fa..1fa766da6 100644 --- a/minimal-examples/http-client/minimal-http-client/minimal-http-client.c +++ b/minimal-examples/http-client/minimal-http-client/minimal-http-client.c @@ -41,8 +41,15 @@ callback_http(struct lws *wsi, enum lws_callback_reasons reason, break; case LWS_CALLBACK_ESTABLISHED_CLIENT_HTTP: - status = lws_http_client_http_response(wsi); - lwsl_user("Connected with server response: %d\n", status); + { + char buf[128]; + + lws_get_peer_simple(wsi, buf, sizeof(buf)); + status = lws_http_client_http_response(wsi); + + lwsl_user("Connected to %s, http response: %d\n", + buf, status); + } #if defined(LWS_WITH_HTTP2) if (long_poll) { lwsl_user("%s: Client entering long poll mode\n", __func__);