server-name: default to no server name unless set in context
authorAndy Green <andy@warmcat.com>
Tue, 7 Mar 2017 23:35:27 +0000 (07:35 +0800)
committerAndy Green <andy@warmcat.com>
Tue, 7 Mar 2017 23:35:27 +0000 (07:35 +0800)
lib/context.c
lib/header.c

index 7f4237a..379e8f9 100644 (file)
@@ -816,9 +816,6 @@ lws_create_context(struct lws_context_creation_info *info)
                context->server_string = info->server_string;
                context->server_string_len = (short)
                                strlen(context->server_string);
-       } else {
-               context->server_string = "libwebsockets";
-               context->server_string_len = 13;
        }
 
 #if LWS_MAX_SMP > 1
index 1e2c17b..46bdb03 100644 (file)
@@ -199,12 +199,14 @@ lws_add_http_header_status(struct lws *wsi, unsigned int code,
                headers = headers->next;
        }
 
-       if (lws_add_http_header_by_token(wsi, WSI_TOKEN_HTTP_SERVER,
+       if (wsi->context->server_string)
+               if (lws_add_http_header_by_token(wsi,
+                                        WSI_TOKEN_HTTP_SERVER,
                                         (unsigned char *)
                                                 wsi->context->server_string,
                                         wsi->context->server_string_len,
                                         p, end))
-               return 1;
+                       return 1;
 
        if (wsi->vhost->options & LWS_SERVER_OPTION_STS)
                if (lws_add_http_header_by_name(wsi, (unsigned char *)