From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: emacs-25 b6b47AF: Properly encode/decode base64Binary data in SOAP Date: Sun, 13 Mar 2016 20:30:02 +0200 Message-ID: <83oaaidydx.fsf@gnu.org> References: <20160106200404.17375.71733@vcs.savannah.gnu.org> <87oaalxvi7.fsf@linux-m68k.org> <87k2l9xg19.fsf@linux-m68k.org> <87d1r1x84z.fsf@linux-m68k.org> <83lh5mfjsn.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1457893850 7297 80.91.229.3 (13 Mar 2016 18:30:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 13 Mar 2016 18:30:50 +0000 (UTC) Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Thomas Fitzsimmons Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 13 19:30:45 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 1afAmp-0004zD-R9 for ged-emacs-devel@m.gmane.org; Sun, 13 Mar 2016 19:30:43 +0100 Original-Received: from localhost ([::1]:37111 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afAmp-0003eH-89 for ged-emacs-devel@m.gmane.org; Sun, 13 Mar 2016 14:30:43 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51917) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afAmj-0003e6-NL for emacs-devel@gnu.org; Sun, 13 Mar 2016 14:30:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1afAmf-0004JH-B2 for emacs-devel@gnu.org; Sun, 13 Mar 2016 14:30:37 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:42884) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afAmf-0004J5-7q; Sun, 13 Mar 2016 14:30:33 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4678 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1afAme-00077j-8J; Sun, 13 Mar 2016 14:30:32 -0400 In-reply-to: (message from Thomas Fitzsimmons on Sun, 13 Mar 2016 13:57:32 -0400) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e 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:201629 Archived-At: > From: Thomas Fitzsimmons > Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org > Date: Sun, 13 Mar 2016 13:57:32 -0400 > > (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)) Why does it do that? string-to-multibyte is one of those functions that should never be used. > 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. But that's not what string-to-multibyte does. > 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. I'm not sure we are not mis-communicating: conversion into internal format is what decoding does. Whereas you just said a few messages upthread that you thought strings should be returned undecoded, i.e. as binary streams of bytes. What am I missing? > >> 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. I'm confused: you've just demonstrated that it returns them as multibyte strings with raw bytes in their multibyte encoding. > 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. That'll bring the bug in the debbugs package back, I think. Once again, if you want to return undecoded strings, they should at the very least be unibyte, not multibyte. Apologies if I'm too confused to talk intelligently about this.