Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/812911/?format=api
{ "id": 812911, "url": "http://patchwork.ozlabs.org/api/patches/812911/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170912152153.7729-5-brandon.carpenter@cypherpath.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170912152153.7729-5-brandon.carpenter@cypherpath.com>", "list_archive_url": null, "date": "2017-09-12T15:21:50", "name": "[v3,4/7] io: Allow empty websocket payload", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "c635e4663ddc0e09e6a58b9410e003be0b277fcd", "submitter": { "id": 72031, "url": "http://patchwork.ozlabs.org/api/people/72031/?format=api", "name": "Brandon Carpenter", "email": "brandon.carpenter@cypherpath.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170912152153.7729-5-brandon.carpenter@cypherpath.com/mbox/", "series": [ { "id": 2725, "url": "http://patchwork.ozlabs.org/api/series/2725/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=2725", "date": "2017-09-12T15:21:48", "name": "Update websocket code to more fully support the RFC", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/2725/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/812911/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/812911/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=cypherpath.com header.i=@cypherpath.com\n\theader.b=\"l8+B9alw\"; dkim-atps=neutral" ], "Received": [ "from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xs7zr1cxmz9ryT\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 13 Sep 2017 01:31:04 +1000 (AEST)", "from localhost ([::1]:36538 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1drn9S-0003kc-2T\n\tfor incoming@patchwork.ozlabs.org; Tue, 12 Sep 2017 11:31:02 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:40530)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <brandon.carpenter@cypherpath.com>)\n\tid 1drn18-0004mG-9E\n\tfor qemu-devel@nongnu.org; Tue, 12 Sep 2017 11:22:29 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <brandon.carpenter@cypherpath.com>)\n\tid 1drn14-00072Y-8H\n\tfor qemu-devel@nongnu.org; Tue, 12 Sep 2017 11:22:26 -0400", "from mail-pg0-x22e.google.com ([2607:f8b0:400e:c05::22e]:33058)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <brandon.carpenter@cypherpath.com>)\n\tid 1drn14-000727-1e\n\tfor qemu-devel@nongnu.org; Tue, 12 Sep 2017 11:22:22 -0400", "by mail-pg0-x22e.google.com with SMTP id u18so5254446pgo.0\n\tfor <qemu-devel@nongnu.org>; Tue, 12 Sep 2017 08:22:21 -0700 (PDT)", "from servo.cypherpath.com (68-113-0-218.static.knwc.wa.charter.com.\n\t[68.113.0.218]) by smtp.gmail.com with ESMTPSA id\n\td18sm12753054pfk.11.2017.09.12.08.22.18\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 12 Sep 2017 08:22:19 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=cypherpath.com; s=google;\n\th=mime-version:from:to:cc:subject:date:message-id:in-reply-to\n\t:references; bh=r14jgAiyO+0nsjjc9Wc+WdEfYoQD51qE/EukutcUoUA=;\n\tb=l8+B9alwkpP2HjEY8ictC1AJTeQ0gKqPEem18u+bOSzkmY8nIoXCTln0Qnhi0A3G1O\n\td1wKkI3VjN867gwi3gfZGgrL75vAqx20k2EVA0fVte0kncdQPOWkk3o+dmDMMxlJGUIt\n\ty8MUnXAQQGMqINlTLM6ufNoYQOhf5lejuRInQ=", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:from:to:cc:subject:date:message-id\n\t:in-reply-to:references;\n\tbh=r14jgAiyO+0nsjjc9Wc+WdEfYoQD51qE/EukutcUoUA=;\n\tb=afEESAGm3mmHfzkMiAK3mxJZtZuYm5yMeo9orvMzXZyHfHyc6n/KOPCae4HKaH3EUb\n\t3ECmfQcK/wh1QWHy6N0P3SxXcQTYV1jvzaU/LKXaTE2QbbKugTdp9rq294ko6mXvvOBm\n\tyFYCCIar/7u8JZ+VLX4iXv6Ry/gxUy4twKdB3FQDEMzkqO/o4ZVedDpIatyUPlXhW+mM\n\tfETb5z9qht4znPg9e4/jDdNsT4hds7Tt1kBBEoAvyEW9PTgM3tzXkAmzyUvtqjpnaXmF\n\txfZh+FMuRSsJenuONI3Dr4pT8Ki4QbhJReTC/M0v8MCBP8bje0pOsb2ubr614L3Tt8yC\n\tZ2mA==", "X-Gm-Message-State": "AHPjjUh2lZEjHKpsVb841zKIgsjXsZ01oAZMnYlr0nHcuD3rA6f3si8t\n\tdZl1xExkrzJ4onezSubHksZmTLfhElDzgVcd13Uu2iuUPfX/t/rI8S140fZhse0z/KjeHrnpW4W\n\tITEsQ", "MIME-Version": "1.0", "X-Google-Smtp-Source": "ADKCNb6VFs+4aN4nkJUQ5sylCiYmkZYOlkEwxgt6i2z6tRQvo0n32LYt4pVhEZeNcdC3WXuQgqZY3A==", "X-Received": "by 10.84.131.2 with SMTP id 2mr17194537pld.120.1505229740759;\n\tTue, 12 Sep 2017 08:22:20 -0700 (PDT)", "From": "Brandon Carpenter <brandon.carpenter@cypherpath.com>", "To": "qemu-devel@nongnu.org", "Date": "Tue, 12 Sep 2017 08:21:50 -0700", "Message-Id": "<20170912152153.7729-5-brandon.carpenter@cypherpath.com>", "X-Mailer": "git-send-email 2.14.1", "In-Reply-To": "<20170912152153.7729-1-brandon.carpenter@cypherpath.com>", "References": "<20170912152153.7729-1-brandon.carpenter@cypherpath.com>", "Content-Type": "text/plain; charset=\"US-ASCII\"", "X-detected-operating-system": "by eggs.gnu.org: Genre and OS details not\n\trecognized.", "X-Received-From": "2607:f8b0:400e:c05::22e", "Subject": "[Qemu-devel] [PATCH v3 4/7] io: Allow empty websocket payload", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.21", "Precedence": "list", "List-Id": "<qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<http://lists.nongnu.org/archive/html/qemu-devel/>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Cc": "brandon.carpenter@cypherpath.com", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>" }, "content": "Some browsers send pings/pongs with no payload, so allow empty payloads\ninstead of closing the connection.\n\nSigned-off-by: Brandon Carpenter <brandon.carpenter@cypherpath.com>\n---\n io/channel-websock.c | 62 +++++++++++++++++++++++++---------------------------\n 1 file changed, 30 insertions(+), 32 deletions(-)", "diff": "diff --git a/io/channel-websock.c b/io/channel-websock.c\nindex ced24135ec..3183aeff77 100644\n--- a/io/channel-websock.c\n+++ b/io/channel-websock.c\n@@ -603,44 +603,42 @@ static int qio_channel_websock_decode_payload(QIOChannelWebsock *ioc,\n Error **errp)\n {\n size_t i;\n- size_t payload_len;\n+ size_t payload_len = 0;\n uint32_t *payload32;\n \n- if (!ioc->payload_remain) {\n- error_setg(errp,\n- \"Decoding payload but no bytes of payload remain\");\n- return -1;\n- }\n-\n- /* If we aren't at the end of the payload, then drop\n- * off the last bytes, so we're always multiple of 4\n- * for purpose of unmasking, except at end of payload\n- */\n- if (ioc->encinput.offset < ioc->payload_remain) {\n- payload_len = ioc->encinput.offset - (ioc->encinput.offset % 4);\n- } else {\n- payload_len = ioc->payload_remain;\n- }\n- if (payload_len == 0) {\n- return QIO_CHANNEL_ERR_BLOCK;\n- }\n+ if (ioc->payload_remain) {\n+ /* If we aren't at the end of the payload, then drop\n+ * off the last bytes, so we're always multiple of 4\n+ * for purpose of unmasking, except at end of payload\n+ */\n+ if (ioc->encinput.offset < ioc->payload_remain) {\n+ payload_len = ioc->encinput.offset - (ioc->encinput.offset % 4);\n+ } else {\n+ payload_len = ioc->payload_remain;\n+ }\n+ if (payload_len == 0) {\n+ return QIO_CHANNEL_ERR_BLOCK;\n+ }\n \n- ioc->payload_remain -= payload_len;\n+ ioc->payload_remain -= payload_len;\n \n- /* unmask frame */\n- /* process 1 frame (32 bit op) */\n- payload32 = (uint32_t *)ioc->encinput.buffer;\n- for (i = 0; i < payload_len / 4; i++) {\n- payload32[i] ^= ioc->mask.u;\n- }\n- /* process the remaining bytes (if any) */\n- for (i *= 4; i < payload_len; i++) {\n- ioc->encinput.buffer[i] ^= ioc->mask.c[i % 4];\n+ /* unmask frame */\n+ /* process 1 frame (32 bit op) */\n+ payload32 = (uint32_t *)ioc->encinput.buffer;\n+ for (i = 0; i < payload_len / 4; i++) {\n+ payload32[i] ^= ioc->mask.u;\n+ }\n+ /* process the remaining bytes (if any) */\n+ for (i *= 4; i < payload_len; i++) {\n+ ioc->encinput.buffer[i] ^= ioc->mask.c[i % 4];\n+ }\n }\n \n- buffer_reserve(&ioc->rawinput, payload_len);\n- buffer_append(&ioc->rawinput, ioc->encinput.buffer, payload_len);\n- buffer_advance(&ioc->encinput, payload_len);\n+ if (payload_len) {\n+ buffer_reserve(&ioc->rawinput, payload_len);\n+ buffer_append(&ioc->rawinput, ioc->encinput.buffer, payload_len);\n+ buffer_advance(&ioc->encinput, payload_len);\n+ }\n return 0;\n }\n \n", "prefixes": [ "v3", "4/7" ] }