From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Adam Porter Newsgroups: gmane.emacs.devel Subject: jsonrpc.el uses "Content-Length" headers which seem specific to LSP Date: Wed, 18 Oct 2023 18:17:35 -0500 Message-ID: <04f0ef0b-7fcf-4b09-a1c8-94960d8184cf@alphapapa.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29654"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: emacs-devel To: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Oct 19 01:18:43 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qtFoI-0007W5-9z for ged-emacs-devel@m.gmane-mx.org; Thu, 19 Oct 2023 01:18:42 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtFnV-00039G-A1; Wed, 18 Oct 2023 19:17:53 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtFnO-00038Q-Du for emacs-devel@gnu.org; Wed, 18 Oct 2023 19:17:46 -0400 Original-Received: from purple.birch.relay.mailchannels.net ([23.83.209.150]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtFnK-0005HP-OW for emacs-devel@gnu.org; Wed, 18 Oct 2023 19:17:46 -0400 X-Sender-Id: dreamhost|x-authsender|adam@alphapapa.net Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 14BB984159F; Wed, 18 Oct 2023 23:17:37 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a209.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 9891A8403D7; Wed, 18 Oct 2023 23:17:36 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1697671056; a=rsa-sha256; cv=none; b=gAU4y+u/b1D1Wt/CyHA66Wbxfzt8ICFrbE5yTo+rjQyACtqXVwKLkvaRH6Wvf7bg8JMhH7 TM0GchlebjZHaAHfIHdyTMkOYlJnnEtCKWjOhCi+452IQXG0tq/6YTzyWNHcyCucE66k7/ GxN0VRTD46T8FZiIjgCGPnHZkV2ispRmlnkf0WV0yEbfPXnF6zc4cP/t4Jk2VGBleSzeMN 0/865qDIxiPdY1Oo40q7Oivaf3akWlRUofzVJRqBTjLajbQRRh86yj7GYj9Ot4683z4uO5 8rPUbg6hz8nl3CcQDuf3HoKaMCRKgrdOUOcl8hfnn7DVmxW3dvqvJP8+B4rcSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1697671056; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding:dkim-signature; bh=RN/2loaMtVN/z4sGJThVQ4GYWnSmR0NnJkr9uWAn2j8=; b=qKhlYrr2HxvmtLtAzNhNhNWRu6FN9vlb2m6eLb6WdqWK6h3z3UcecV9v6R2DA+AFNPWVO7 PB4hSiVMMWB7v71LE8TLHrn3+Kn8DeahE9CuEmbErVIN72Hhup59owmbAjX4an4TLiclky 3JxJrydePnbqb3VZr0iN42lRduI2QM/ep+t4nISuk89FVq9kv8AG183Od3qc4ghLUWpcyv 0C9Gf/+40VzsPjc3sW1Q+iFEIfuXrpbuYOBhzR7+oD+81FrZr3Xjaw6o4x4glQjveFWkQw uKyM0YSht1CGLW6jji2Imv7sWwBhrU5stKq0n1Bo7kzZXsjuJ6fqoEc0mQjHJQ== ARC-Authentication-Results: i=1; rspamd-555cdc57c9-4cd6q; auth=pass smtp.auth=dreamhost smtp.mailfrom=adam@alphapapa.net X-Sender-Id: dreamhost|x-authsender|adam@alphapapa.net X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|adam@alphapapa.net X-MailChannels-Auth-Id: dreamhost X-Abaft-Cold: 5f52152b5251aace_1697671056856_3227443843 X-MC-Loop-Signature: 1697671056856:2524296567 X-MC-Ingress-Time: 1697671056856 Original-Received: from pdx1-sub0-mail-a209.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.117.92.224 (trex/6.9.2); Wed, 18 Oct 2023 23:17:36 +0000 Original-Received: from [10.45.0.134] (unknown [45.131.192.7]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: adam@alphapapa.net) by pdx1-sub0-mail-a209.dreamhost.com (Postfix) with ESMTPSA id 4S9mwJ1ND4zDf; Wed, 18 Oct 2023 16:17:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alphapapa.net; s=dreamhost; t=1697671056; bh=RN/2loaMtVN/z4sGJThVQ4GYWnSmR0NnJkr9uWAn2j8=; h=Date:To:From:Subject:Cc:Content-Type:Content-Transfer-Encoding; b=NFmC2FBPLGG0Nkw6CRQzDT1pDavR+3oQj4YqXPAFxwtjoIESQAQdkMraR4R1C/RbY 4x43sU5yl9xTsUW/dLmuv8qfsipgIV+4EOR12OIaQ0pep7GxmJvXoMUsSn0soQP7EY 2DBvA1fZjKP/t9dgCIxQfv78LA415B7juA+AKVGx8ueKBdTrxMIcj8wK8BWbAhxdcN 1tVLYncfiHJx/QeJlXMqQrid/riiD6vozPtvxq4Y+8fISrq7FFjtsl4WcV6j8S7Nch aEtLgAlmvDDRipZIigiGPgcQAS2AuU5D2yMRmvt7NzmJsEx2/b0wnxZYEqAMLf+7d4 2U9pQVmWLw1bA== Content-Language: en-US Received-SPF: neutral client-ip=23.83.209.150; envelope-from=adam@alphapapa.net; helo=purple.birch.relay.mailchannels.net X-Spam_score_int: 15 X-Spam_score: 1.5 X-Spam_bar: + X-Spam_report: (1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RAZOR2_CF_RANGE_51_100=1.886, RAZOR2_CHECK=0.922, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_NEUTRAL=0.779 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:311561 Archived-At: Hi João, et al, In our work on hyperdrive.el (a new project currently packaged on NonGNU ELPA), we're beginning a refactor to use a JSON-RPC backend rather than the HTTP-based API we've been using. In the process we've discovered that jsonrpc.el seems to hard-code the use of HTTP-style "Content-Length" headers. These are required by LSP (obviously, one of the major use-cases for jsonrpc.el), however, as best we can tell, JSON-RPC itself does not mention the use of these headers.[0] And, in fact, the RPC server we're connecting to does not expect them nor send them, and it fails when encountering them. With jsonrpc.el being based on EIEIO and generic methods, we work around this easily enough by defining our own process connection type subclassing jsonrpc-process-connection with associated methods that omit the header-related code (not sending the header with requests, and not looking for one when parsing responses, just trying to parse the incoming text as JSON). This seems to work well, and the code is pleasantly simple. However, we wonder if jsonrpc.el is not quite as generic as it should be, i.e. whether the use of these HTTP-style headers should be done in a specific subclass rather than the jsonrpc-process-connection one, so that other, non-LSP JSON-RPC servers could be used more easily. Would that be reasonable, or am I missing something (which wouldn't be surprising, as some of this is new territory for me)? I hope I'm not retreading old ground by bringing this up; I searched the list and bug tracker but couldn't find anything relevant. Thanks, Adam 0: https://www.jsonrpc.org/specification