emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: emacs-25 b6b47AF: Properly encode/decode base64Binary data in SOAP


From: Thomas Fitzsimmons
Subject: Re: emacs-25 b6b47AF: Properly encode/decode base64Binary data in SOAP
Date: Sun, 13 Mar 2016 13:57:32 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

>> From: Thomas Fitzsimmons <address@hidden>
>> Date: Sat, 12 Mar 2016 22:52:25 -0500
>> Cc: address@hidden
>> 
>> 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.
>
> They should be unibyte, I agree with Stefan.  If you return multibyte
> strings, they should be decoded.

Sorry, I wasn't being precise when I said "unchanged".  The result from
the server goes through several steps before soap-client returns the
multibyte string result:

   (defun soap-parse-server-response ()
     "Error-check and parse the XML contents of the current buffer."
     (let ((mime-part (mm-dissect-buffer t t)))
       (unless mime-part
         (error "Failed to decode response from server"))
       (unless (equal (car (mm-handle-type mime-part)) "text/xml")
         (error "Server response is not an XML document"))
       (with-temp-buffer
         (mm-insert-part mime-part)
         (prog1
             (car (xml-parse-region (point-min) (point-max)))
           (kill-buffer)
           (mm-destroy-part mime-part)))))

mm-insert-part does:

   (string-to-multibyte (mm-get-part handle no-cache))

In cases where the caller is expecting an xsd:string, the idea is for
soap-client to return a native Emacs string, for the caller's
convenience.  I guess soap-client assumes that the mm and xml packages
will do the right thing to convert XML string values into Emacs's
internal format.

>> Is the attached patch OK for master and emacs-25?
>
> Doesn't it bring back the bug which caused Andreas to make the change
> you want to undo?

It brings back the behavior of soap-client returning base64-decoded
xsd:base64Binary values as unibyte strings.  The debate on this thread
is about whether that behavior is buggy or not.  But yes, I want to
revert Andreas's change on both master and emacs-25 branches, because I
don't consider the old behavior buggy.

Thomas



reply via email to

[Prev in Thread] Current Thread [Next in Thread]