From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thomas Fitzsimmons Newsgroups: gmane.emacs.devel Subject: Re: emacs-25 b6b47AF: Properly encode/decode base64Binary data in SOAP Date: Sat, 12 Mar 2016 22:52:25 -0500 Message-ID: References: <20160106200404.17375.71733@vcs.savannah.gnu.org> <87oaalxvi7.fsf@linux-m68k.org> <87k2l9xg19.fsf@linux-m68k.org> <87d1r1x84z.fsf@linux-m68k.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1457841162 22992 80.91.229.3 (13 Mar 2016 03:52:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 13 Mar 2016 03:52:42 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 13 04:52:35 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aex50-0006Fy-WE for ged-emacs-devel@m.gmane.org; Sun, 13 Mar 2016 04:52:35 +0100 Original-Received: from localhost ([::1]:34427 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aex50-0005PH-FM for ged-emacs-devel@m.gmane.org; Sat, 12 Mar 2016 22:52:34 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41111) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aex4x-0005PC-Mi for emacs-devel@gnu.org; Sat, 12 Mar 2016 22:52:32 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aex4u-0000EA-Ff for emacs-devel@gnu.org; Sat, 12 Mar 2016 22:52:31 -0500 Original-Received: from mail-io0-x22b.google.com ([2607:f8b0:4001:c06::22b]:36736) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aex4u-0000E6-4N for emacs-devel@gnu.org; Sat, 12 Mar 2016 22:52:28 -0500 Original-Received: by mail-io0-x22b.google.com with SMTP id z76so188357598iof.3 for ; Sat, 12 Mar 2016 19:52:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fitzsim-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=IlqaNjc+6HtrgHXIxdo4Ts6jQpCZPwIT17452vS4DDE=; b=cQkdvZ7XnaugRd60Zl/S/Vu+9DEPnIb3IU2On3Dnt2PBXbdRJXRCt9VDF+ottdbV4P njZ7iqnETgKr8ZlY3Pdqkx6Njq4eqEnEH4zbY5PKjwmo1UFLgfcJKhEg3qKFzEidPUTp qmfqB7/etkWhKGsFZBLEtUJJf5VcO6gvWhAsiDYPGGGB6GB2DO34OB1i4PrvgkkPWyoU evLMqUAPJE2h2ysgVXrbY0QPdWNs+DRkIHQYrPjcMVO9kZOVMUJdONJ7MvRUXBeMMRR5 14zgEOGe9J+SdFg1x/hj8QySVZPqnaP8TaJ0g86mewS82HMyUSvWwE5RSgwIQWjmYoZp H72g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=IlqaNjc+6HtrgHXIxdo4Ts6jQpCZPwIT17452vS4DDE=; b=UgHzKMo44dXUpiriWLZzIMaCP3HV4J1i6HMw5c21txu10Ny/Jt5c/w3qYcRI+CRezU t7QdePCiiGMTuPv0rVTR4U6NVWY5DCGExUAM3Ph/wIw2kjV0WmMR3fFUl5NKYO6HxFMX GHZroDbcR1KbsDrSaj0siKs6WnbuX76Hm/xS9yO+mmshXws9vYEuafOMRrv7m/SC5Eoi X/ZnXPrwmRy0vDz9SXkuIXqJRXFKXwzODlXrVIsIvGKLjUxfrK/9sH1gwChJCqCznAJh T0EGkMLZvejxlfOz2J+9cXHaOJ9vVB/pgsL8ZzIxaZkjj72huNg3AHz2tNbJsH4dLuXI hRnA== X-Gm-Message-State: AD7BkJJlm7FcXpSOK6GCCcvLCq3ghctt5jxhXMRPuvPQcJTmTon7PbbaB5/HMOnWsqKikw== X-Received: by 10.107.151.133 with SMTP id z127mr17234083iod.191.1457841147238; Sat, 12 Mar 2016 19:52:27 -0800 (PST) Original-Received: from hp-dv5t (69-165-165-189.dsl.teksavvy.com. [69.165.165.189]) by smtp.gmail.com with ESMTPSA id ie9sm4046467igb.10.2016.03.12.19.52.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 12 Mar 2016 19:52:26 -0800 (PST) In-Reply-To: (Stefan Monnier's message of "Fri, 11 Mar 2016 17:27:16 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4001:c06::22b X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:201577 Archived-At: --=-=-= Content-Type: text/plain Stefan Monnier writes: >> The interface does not return bytes, it returns a (half-)decoded lisp >> form. > > My understanding is that it returns a structure whose leaves are > all byte-strings because. String values are returned as multibyte, e.g.: (multibyte-string-p (cdr (assq 'severity (car (debbugs-get-status 22285))))) => t because parsing happens in a temporary buffer where enable-multibyte-characters is set, and the string value is returned unchanged. > In this sense, they're all "undecoded". And the meaning of those > byte-strings is not specified by the generic format, so the generic > parser can't know if or how to decode them. This is true for base64Binary values. I'd like to change the base64Binary behavior back, but we can document this nuance of the API. Also, on the encoding side I think we should force the caller to provide unibyte strings for base64Binary values. Is the attached patch OK for master and emacs-25? Thomas --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=emacs-soap-client-document-base64-handling.patch diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el index 7402464..bee3a12 100644 --- a/lisp/net/soap-client.el +++ b/lisp/net/soap-client.el @@ -536,9 +536,10 @@ soap-encode-xs-basic-type (number-to-string value)) (base64Binary - (unless (stringp value) - (error "Not a string value for base64Binary")) - (base64-encode-string (encode-coding-string value 'utf-8))) + (unless (and (stringp value) + (not (multibyte-string-p value))) + (error "Not a unibyte string value for base64Binary")) + (base64-encode-string value)) (otherwise (error "Don't know how to encode %s for type %s" @@ -682,7 +683,7 @@ soap-decode-xs-basic-type decimal byte float double duration) (string-to-number (car contents))) (boolean (string= (downcase (car contents)) "true")) - (base64Binary (decode-coding-string (base64-decode-string (car contents)) 'utf-8)) + (base64Binary (base64-decode-string (car contents))) (anyType (soap-decode-any-type node)) (Array (soap-decode-array node)))))) @@ -3096,7 +3097,9 @@ soap-invoke NOTE: The SOAP service provider should document the available operations and their parameters for the service. You can also use the `soap-inspect' function to browse the available -operations in a WSDL document." +operations in a WSDL document. `soap-invoke' base64-decodes +base64Binary return values into unibyte strings; these +byte-strings require further interpretation by the caller." (apply #'soap-invoke-internal nil nil wsdl service operation-name parameters)) (defun soap-invoke-async (callback cbargs wsdl service operation-name --=-=-=--