bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#37187: 26.2; url-retrieve redirect lost Authorization headers


From: Romain Ouabdelkader
Subject: bug#37187: 26.2; url-retrieve redirect lost Authorization headers
Date: Mon, 26 Aug 2019 00:08:35 +0200


Hello,

I have an issue with the 'url-retrieve' function:
If the target url returns a redirect, the 'Authorization' header is not
sent on the redirect url.

Example:

List of endpoint:

http://localhost/a: 308 redirect to http://localhost/b
http://localhost/b: display all received headers

I will be using 'url-retrieve' on url 'http://localhost/a' with headers:

Authorization: Basic YWxhZGRpbjpvcGVuc2VzYW1l
X-ExampleHeader: foo

The response shows 'X-ExampleHeader' but not 'Authorization'.
Is there a way to forward 'Authorization' aswell?

Here is a code sample:

(let ((url-request-extra-headers '(("Authorization" . "Basic YWxhZGRpbjpvcGVuc2VzYW1l")
                                   ("X-ExampleHeader" . "foo"))))
  (url-retrieve "http://localhost:5000/a" (lambda (status) 
                                            (display-buffer (current-buffer) t))))

Server in Python with flask (pip install flask): 

from flask import Flask, redirect, request, jsonify

app = Flask(__name__)

@app.route('/a')
def a():
    return redirect("http://localhost:5000/b", code=308)

@app.route('/b')
def b():
    return jsonify(dict(request.headers))

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=5000)

In GNU Emacs 26.2 (build 1, x86_64-apple-darwin18.2.0, NS appkit-1671.20 Version 10.14.3 (Build 18D109))
 of 2019-04-13 built on builder10-14.porkrind.org
Windowing system distributor 'Apple', version 10.3.1671
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Mark set
user-error: Beginning of history; no preceding item
Contacting host: localhost:8080
Undo!
Making completion list... [2 times]

Configured using:
 'configure --with-ns '--enable-locallisppath=/Library/Application
 Support/Emacs/${version}/site-lisp:/Library/Application
 Support/Emacs/site-lisp' --with-modules'

Configured features:
NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES THREADS

Important settings:
  value of $LC_CTYPE: UTF-8
  value of $LANG: en_FR.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message dired dired-loaddefs format-spec
rfc822 mml easymenu mml-sec epa derived epg epg-config gnus-util rmail
rmail-loaddefs mm-decode mm-bodies mm-encode mailabbrev gmm-utils
mailheader sendmail mail-utils network-stream starttls url-cache
url-http tls gnutls mail-parse rfc2231 rfc2047 rfc2045 mm-util
ietf-drums mail-prsvr url-gw nsm rmc puny seq url-auth url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
url-util url-parse auth-source cl-seq eieio byte-opt bytecomp
byte-compile cconv eieio-core cl-macs gv eieio-loaddefs cl-loaddefs
cl-lib password-cache url-vars mailcap elec-pair time-date tooltip eldoc
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/ns-win
ns-win ucs-normalize mule-util term/common-win tool-bar dnd fontset
image regexp-opt fringe tabulated-list replace newcomment text-mode
elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow
isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core term/tty-colors frame cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads kqueue cocoa ns multi-tty
make-network-process emacs)

Memory information:
((conses 16 215729 11157)
 (symbols 48 21206 1)
 (miscs 40 48 218)
 (strings 32 32992 1542)
 (string-bytes 1 877912)
 (vectors 16 36759)
 (vector-slots 8 744932 10148)
 (floats 8 51 242)
 (intervals 56 379 360)
 (buffers 992 13))

reply via email to

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