From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Artur Malabarba Newsgroups: gmane.emacs.help Subject: url-retrieve-synchronously results differ from curl Date: Tue, 20 Jan 2015 00:28:46 -0200 Message-ID: Reply-To: bruce.connor.am@gmail.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1421720944 23641 80.91.229.3 (20 Jan 2015 02:29:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 20 Jan 2015 02:29:04 +0000 (UTC) To: help-gnu-emacs , Sean Allred Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jan 20 03:29:04 2015 Return-path: Envelope-to: geh-help-gnu-emacs@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 1YDOYv-0002BJ-OG for geh-help-gnu-emacs@m.gmane.org; Tue, 20 Jan 2015 03:29:01 +0100 Original-Received: from localhost ([::1]:40922 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDOYv-0001eX-7R for geh-help-gnu-emacs@m.gmane.org; Mon, 19 Jan 2015 21:29:01 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43312) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDOYi-0001bZ-LU for help-gnu-emacs@gnu.org; Mon, 19 Jan 2015 21:28:49 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YDOYh-000496-B0 for help-gnu-emacs@gnu.org; Mon, 19 Jan 2015 21:28:48 -0500 Original-Received: from mail-oi0-x234.google.com ([2607:f8b0:4003:c06::234]:51120) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDOYh-00048z-4N for help-gnu-emacs@gnu.org; Mon, 19 Jan 2015 21:28:47 -0500 Original-Received: by mail-oi0-f52.google.com with SMTP id h136so8158450oig.11 for ; Mon, 19 Jan 2015 18:28:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:date:message-id:subject:from:to :content-type; bh=bEUgdvvuwL8AHTfIh+QUu+sgV1FqqUDoLKv9supVM5o=; b=XCYjqO0nUgikeXtoa1Hvb/ZiEZF8TVLKxd2RbpZWZgyDUL2+fdSt5gmb0pXepmROX1 lcUon5mzCzd4fUDR+7QYLTuim5XqpWnd7sbLPNaaBu4vT/bIkYUnydNBQTM6dEHr+BBf ftfIlb/geKQskM69xXeoYBKx8oXzpz2RSjvbjTf0CTi9SNo4wE9rXT7RPmFODWio22dO pZW/9il8HXgPWJcg+iQX3klptZrD0UlPfUbntJfH8dqmEULIxrQWddKib7g2w1yG56K6 Xhpr9mMD2UzzoZrpBbNf2lgjUTZvawHC+5jBbUaLWKbKXxcLmoRSCPgvCWWqWMrxrKNl Kr0w== X-Received: by 10.60.62.241 with SMTP id b17mr20007376oes.17.1421720926100; Mon, 19 Jan 2015 18:28:46 -0800 (PST) Original-Received: by 10.76.125.1 with HTTP; Mon, 19 Jan 2015 18:28:46 -0800 (PST) X-Google-Sender-Auth: mzbOqzt7mFIYk3O-vUrVOeW04D4 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c06::234 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:102166 Archived-At: There are further details on this phenomenon at this link http://emacs.stackexchange.com/q/7545/50 In short, we're trying to do a post request with `url-retrieve-synchronously', but it's yielding a different result than the same request using curl. The url request *works*, in that it performs the post and returns sane results. However, these results are not the expected ones, and performing the same request using curl does return the expected results. It's possible this is just a bug in the API we're posting to, but it's more likely we just haven't built this request correctly in url-retrieve-synchronously. This would explain why it's being handled differently from the request we make with curl. We'd appreciate the input from anyone who knows more about the `url' package, before we run off blaming the API. :-) Less relevant details can be found at the linked question, but below is the basic url call we're using. The address and data-args variables are defined elsewhere, but I'm just looking to know whether we're doing something wrong with the url call. (let ((url-automatic-caching t) (url-inhibit-uncompression t) (url-request-data data-args) (url-request-method "post") (url-request-extra-headers '(("Content-Type" . "application/x-www-form-urlencoded")))) (with-current-buffer (url-retrieve-synchronously address) (goto-char (point-min)) (search-forward "\n\n") (delete-region (point-min) (point)) (buffer-string))) For comparison, here's the curl command we use (which returns different results) (format "curl --silent -X POST --data %S %s" data-args address) Thanks a lot Artur Malabarba