X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;ds=inline;f=src%2Fafb-websock.c;h=1c087e25fc79bf84b960b7712819a8fb0e2a2203;hb=520bbafb30ce49b94b7825ff553d8cb5bda6d612;hp=90148ecfa48d38af2eabbc9fb724af931ed44669;hpb=acdf592fee6d7f1970e42e31c23c2a88196051aa;p=src%2Fapp-framework-binder.git diff --git a/src/afb-websock.c b/src/afb-websock.c index 90148ecf..1c087e25 100644 --- a/src/afb-websock.c +++ b/src/afb-websock.c @@ -39,7 +39,7 @@ static const char sec_websocket_key_s[] = "Sec-WebSocket-Key"; static const char sec_websocket_version_s[] = "Sec-WebSocket-Version"; static const char sec_websocket_accept_s[] = "Sec-WebSocket-Accept"; static const char sec_websocket_protocol_s[] = "Sec-WebSocket-Protocol"; -static const char websocket_uuid[] = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; +static const char websocket_guid[] = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; struct afb_websock @@ -108,10 +108,10 @@ static void make_accept_value(const char *key, char result[29]) { unsigned char md[SHA_DIGEST_LENGTH+1]; size_t len = strlen(key); - char *buffer = alloca(len + sizeof websocket_uuid - 1); + char *buffer = alloca(len + sizeof websocket_guid - 1); memcpy(buffer, key, len); - memcpy(buffer + len, websocket_uuid, sizeof websocket_uuid - 1); - SHA1((const unsigned char *)buffer, (unsigned long)(len + sizeof websocket_uuid - 1), md); + memcpy(buffer + len, websocket_guid, sizeof websocket_guid - 1); + SHA1((const unsigned char *)buffer, (unsigned long)(len + sizeof websocket_guid - 1), md); assert(SHA_DIGEST_LENGTH == 20); md[20] = 0; enc64(&md[0], &result[0]); @@ -152,13 +152,11 @@ int afb_websock_check(struct afb_hreq *hreq, int *later) /* is an upgrade to websocket ? */ upgrade = afb_hreq_get_header(hreq, MHD_HTTP_HEADER_UPGRADE); -printf("upgrade %s\n", upgrade); if (upgrade == NULL || strcasecmp(upgrade, websocket_s)) return 0; /* is a connection for upgrade ? */ connection = afb_hreq_get_header(hreq, MHD_HTTP_HEADER_CONNECTION); -printf("connection %s\n", connection); if (connection == NULL || !headerhas (connection, MHD_HTTP_HEADER_UPGRADE)) return 0; @@ -169,8 +167,6 @@ printf("connection %s\n", connection); /* has a key and a version ? */ key = afb_hreq_get_header(hreq, sec_websocket_key_s); version = afb_hreq_get_header(hreq, sec_websocket_version_s); -printf("key %s\n", key); -printf("version %s\n", connection); if (key == NULL || version == NULL) return 0;