unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Thomas Fitzsimmons <fitzsim@fitzsim.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: emacs-25 b6b47AF: Properly encode/decode base64Binary data in SOAP
Date: Sat, 12 Mar 2016 22:52:25 -0500	[thread overview]
Message-ID: <m38u1nxcee.fsf@fitzsim.org> (raw)
In-Reply-To: <jwv37rwfy8g.fsf-monnier+gmane.emacs.devel@gnu.org> (Stefan Monnier's message of "Fri, 11 Mar 2016 17:27:16 -0500")

[-- Attachment #1: Type: text/plain, Size: 989 bytes --]

Stefan Monnier <monnier@iro.umontreal.ca> 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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: emacs-soap-client-document-base64-handling.patch --]
[-- Type: text/x-patch, Size: 1824 bytes --]

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

  reply	other threads:[~2016-03-13  3:52 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20160106200404.17375.71733@vcs.savannah.gnu.org>
     [not found] ` <E1aGuJQ-0004Wv-Lz@vcs.savannah.gnu.org>
2016-03-10  1:03   ` emacs-25 b6b47af: Properly encode/decode base64Binary data in SOAP Thomas Fitzsimmons
2016-03-10  9:30     ` Andreas Schwab
2016-03-11  3:29       ` emacs-25 b6b47AF: " Thomas Fitzsimmons
2016-03-11  8:35         ` Andreas Schwab
2016-03-11 13:49           ` Alex Harsanyi
2016-03-11 14:09             ` Andreas Schwab
2016-03-11 16:48               ` Stefan Monnier
2016-03-11 16:59                 ` Andreas Schwab
2016-03-11 22:27                   ` Stefan Monnier
2016-03-13  3:52                     ` Thomas Fitzsimmons [this message]
2016-03-13 15:15                       ` Stefan Monnier
2016-03-13 18:09                         ` Thomas Fitzsimmons
2016-03-13 16:02                       ` Eli Zaretskii
2016-03-13 17:57                         ` Thomas Fitzsimmons
2016-03-13 18:30                           ` Eli Zaretskii
2016-03-13 19:54                             ` Thomas Fitzsimmons
2016-03-13 20:19                               ` Eli Zaretskii
2016-03-13 21:17                                 ` Thomas Fitzsimmons
2016-03-14  3:30                                   ` Eli Zaretskii
2016-03-14  8:49                                     ` Andreas Schwab
2016-03-14  9:15                                       ` Michael Albinus
2016-03-14 11:56                                         ` Stefan Monnier
2016-03-14 12:18                                           ` Alex Harsanyi
2016-03-14 11:58                                         ` Alex Harsanyi
2016-03-14 12:38                                           ` Michael Albinus
2016-03-14 13:18                                             ` Alex Harsanyi
2016-03-14 13:30                                               ` Michael Albinus
2016-03-14 13:26                                             ` Stefan Monnier
2016-03-14 14:12                                               ` Michael Albinus
2016-03-14 14:58                                                 ` Thomas Fitzsimmons
2016-03-14 15:56                                                   ` Michael Albinus
2016-03-14 17:58                                                   ` Eli Zaretskii
2016-03-15  1:56                                                     ` Thomas Fitzsimmons
2016-03-15  7:45                                                       ` Andreas Schwab
2016-03-15  7:57                                                         ` Michael Albinus
2016-03-15  7:49                                                       ` Andreas Schwab
2016-03-15  8:08                                                       ` Michael Albinus
2016-03-15 14:39                                                         ` Thomas Fitzsimmons
2016-03-15 15:04                                                           ` Michael Albinus
2016-03-17 14:23                                                             ` Thomas Fitzsimmons
2016-03-17 15:39                                                               ` Thomas Fitzsimmons
2016-03-17 19:24                                                                 ` Michael Albinus
2016-03-17 15:46                                                               ` Stefan Monnier
2016-03-15 17:39                                                           ` Eli Zaretskii
2016-03-14 17:53                                           ` Eli Zaretskii
2016-03-14 18:47                                             ` Michael Albinus
2016-03-14 18:57                                               ` Eli Zaretskii
2016-03-14 17:49                                         ` Eli Zaretskii
2016-03-14 18:44                                           ` Michael Albinus
2016-03-14 18:52                                             ` Eli Zaretskii
2016-03-14 19:05                                               ` Michael Albinus
2016-03-14  9:23                                       ` Thomas Fitzsimmons
2016-03-14  9:58                                         ` Andreas Schwab
2016-03-14  8:02                                   ` Michael Albinus
2016-03-14 12:39                                     ` Stefan Monnier
2016-03-14 17:55                                       ` Eli Zaretskii
2016-03-14 17:48                                     ` Eli Zaretskii
2016-03-14 18:42                                       ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m38u1nxcee.fsf@fitzsim.org \
    --to=fitzsim@fitzsim.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).