use context service buffer instead of stack for clent_connect_2 47/3047/1
authorAndy Green <andy.green@linaro.org>
Sun, 10 Feb 2013 07:19:39 +0000 (15:19 +0800)
committerKevron Rees <kevron_m_rees@linux.intel.com>
Thu, 7 Mar 2013 21:01:32 +0000 (13:01 -0800)
Signed-off-by: Andy Green <andy.green@linaro.org>
lib/client-handshake.c

index 48c9a96..1fc78f7 100644 (file)
@@ -9,7 +9,6 @@ struct libwebsocket *__libwebsocket_client_connect_2(
        struct sockaddr_in server_addr;
        int n;
        int plen = 0;
-       char pkt[512];
 
        lwsl_client("__libwebsocket_client_connect_2\n");
 #ifndef LWS_NO_EXTENSIONS
@@ -21,7 +20,8 @@ struct libwebsocket *__libwebsocket_client_connect_2(
         */
 
        if (context->http_proxy_port) {
-               plen = sprintf(pkt, "CONNECT %s:%u HTTP/1.0\x0d\x0a"
+               plen = sprintf(context->service_buffer,
+                       "CONNECT %s:%u HTTP/1.0\x0d\x0a"
                        "User-agent: libwebsockets\x0d\x0a"
 /*Proxy-authorization: basic aGVsbG86d29ybGQ= */
                        "\x0d\x0a", wsi->c_address, wsi->c_port);
@@ -79,7 +79,7 @@ struct libwebsocket *__libwebsocket_client_connect_2(
 
        if (context->http_proxy_port) {
 
-               n = send(wsi->sock, pkt, plen, 0);
+               n = send(wsi->sock, context->service_buffer, plen, 0);
                if (n < 0) {
                        compatible_close(wsi->sock);
                        lwsl_debug("ERROR writing to proxy socket\n");