fix-host-header-contents--introduce-canonical-hostname-api.patch

I?aki pointed out the dummy host field used in client test and ping
is not valid http.  This patch changes it to use the actual host
name and adds an api to collect that from the context cheaply.

Reported-by: I?aki Baz Castillo <ibc@aliax.net>
Signed-off-by: Andy Green <andy@warmcat.com>
diff --git a/test-server/test-client.c b/test-server/test-client.c
index 734aab2..289374a 100644
--- a/test-server/test-client.c
+++ b/test-server/test-client.c
@@ -25,7 +25,6 @@
 #include <getopt.h>
 #include <string.h>
 
-
 #include "../lib/libwebsockets.h"
 #include <poll.h>
 
@@ -170,7 +169,6 @@
 	struct libwebsocket *wsi_dumb;
 	struct libwebsocket *wsi_mirror;
 
-
 	fprintf(stderr, "libwebsockets test client\n"
 			"(C) Copyright 2010 Andy Green <andy@warmcat.com> "
 						    "licensed under LGPL2.1\n");
@@ -215,7 +213,7 @@
 	/* create a client websocket using dumb increment protocol */
 
 	wsi_dumb = libwebsocket_client_connect(context, address, port, use_ssl,
-					"/", "http://host", "origin",
+			"/", libwebsocket_canonical_hostname(context), "origin",
 				       protocols[PROTOCOL_DUMB_INCREMENT].name);
 
 	if (wsi_dumb == NULL) {
@@ -226,7 +224,7 @@
 	/* create a client websocket using mirror protocol */
 
 	wsi_mirror = libwebsocket_client_connect(context, address, port,
-					use_ssl,  "/", "http://host", "origin",
+	     use_ssl,  "/", libwebsocket_canonical_hostname(context), "origin",
 				       protocols[PROTOCOL_LWS_MIRROR].name);
 
 	if (wsi_mirror == NULL) {