unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Artur Malabarba <bruce.connor.am@gmail.com>
To: help-gnu-emacs <help-gnu-emacs@gnu.org>,
	Sean Allred <code@seanallred.com>
Subject: url-retrieve-synchronously results differ from curl
Date: Tue, 20 Jan 2015 00:28:46 -0200	[thread overview]
Message-ID: <CAAdUY-LUCEf8ftozE4S=LgKb6S5T3Weg7Bmt6NpR+ioVbRkMWQ@mail.gmail.com> (raw)

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


             reply	other threads:[~2015-01-20  2:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-20  2:28 Artur Malabarba [this message]
2015-01-20  7:37 ` url-retrieve-synchronously results differ from curl Nicolas Richard
2015-01-20 15:35   ` Artur Malabarba
2015-01-21  7:13     ` Nicolas Richard
2015-01-21 13:14       ` Artur Malabarba
2015-01-21 13:42         ` Nicolas Richard
2015-01-21 14:27       ` Sean Allred
2015-01-21 16:29         ` Thien-Thi Nguyen
2015-01-22  1:14         ` Artur Malabarba
2015-01-22  2:41           ` Artur Malabarba
2015-01-22  9:00           ` Thien-Thi Nguyen
2015-01-21  8:01 ` Thien-Thi Nguyen
2015-01-21 14:14   ` Artur Malabarba

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='CAAdUY-LUCEf8ftozE4S=LgKb6S5T3Weg7Bmt6NpR+ioVbRkMWQ@mail.gmail.com' \
    --to=bruce.connor.am@gmail.com \
    --cc=code@seanallred.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.
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).