unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#11469: 24.1.50; url-retrieve with PUT method fails every two times
@ 2012-05-14 11:31 Takafumi Arakaki
  2012-12-20 20:13 ` bug#11469: [PATCH] Fix bug #11469; propagate url-request-* vars properly Takafumi Arakaki
  0 siblings, 1 reply; 3+ messages in thread
From: Takafumi Arakaki @ 2012-05-14 11:31 UTC (permalink / raw)
  To: 11469

This bug report will be sent to the Bug-GNU-Emacs mailing list
and the GNU bug tracker at debbugs.gnu.org.  Please check that
the From: line contains a valid email address.  After a delay of up
to one day, you should receive an acknowledgement at that address.

Please write in English if possible, as the Emacs maintainers
usually do not have translators for other languages.

Please describe exactly what actions triggered the bug, and
the precise symptoms of the bug.  If you can, give a recipe
starting from `emacs -Q':


I found some probelem using url-retrieve.  To reproduce the probelem you
can use the following snippet:

(let ((url "http://127.0.0.1:9999/")
      (url-request-method "PUT")
      (url-request-extra-headers '(("Content-Type" . "application/json")))
      (url-request-data "[1 2 3]"))
  (url-retrieve url (lambda (status))))

I am executing the above snippet (using eval-last-sexp at the end of the
exnippet) and it fails every two times (it succeeds and then fails and
then succeeds and then ...).  I got this message when it fails:

error in process sentinel: url-http-end-of-document-sentinel: Symbol's
value as variable is void: url-request-method
error in process sentinel: Symbol's value as variable is void:
url-request-method

I checked above with emacs started by emacs-snapshot -Q.

Furthremore, in some case I have url-request-method set to nil at global
lavel (M-: url-request-method RET gives nil).  And in this case, GET
method is used instead.  I guess this is because of
"(or url-request-method "GET")" in url-http.

I guess it won't matter, but I am using Python tornado as a web server
to check the behavior.  This is the test server I am using:

import tornado.ioloop
import tornado.web


class MainHandler(tornado.web.RequestHandler):

    def get(self):
        print "GET"
        print self.request.body
        self.write("Hello, world")
        self.finish()

    def put(self):
        print "PUT"
        print self.request.body
        self.set_status(204)
        self.finish()


application = tornado.web.Application([
    (r"/", MainHandler),
])

if __name__ == "__main__":
    application.listen(9999)
    tornado.ioloop.IOLoop.instance().start()


If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
For information about debugging Emacs, please read the file
/usr/share/emacs/24.1.50/etc/DEBUG.


In GNU Emacs 24.1.50.1 (i686-pc-linux-gnu, GTK+ Version 2.22.0)
 of 2012-04-10 on mercury, modified by Debian
 (emacs-snapshot package, version 2:20120410-1~ppa1~maverick1)
Windowing system distributor `The X.Org Foundation', version 11.0.10900000
Configured using:
 `configure '--build' 'i686-linux-gnu' '--host' 'i686-linux-gnu'
 '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib'
 '--localstatedir=/var' '--infodir=/usr/share/info'
 '--mandir=/usr/share/man' '--with-pop=yes'
 '--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/24.1.50/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.1.50/site-lisp:/usr/share/emacs/site-lisp'
 '--without-compress-info' '--with-crt-dir=/usr/lib//' '--with-x=yes'
 '--with-x-toolkit=gtk' '--with-imagemagick=yes'
 'build_alias=i686-linux-gnu' 'host_alias=i686-linux-gnu'
 'CFLAGS=-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2' 'LDFLAGS=-g
 -Wl,--as-needed -znocombreloc' 'CPPFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  tooltip-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

Recent input:
C-x C-f C-y <return> C-x C-f <up> <backspace> <backspace>
p <tab> <return> C-x b <return> C-n C-n C-n C-n C-n
C-n C-n C-n C-n C-n C-e C-n C-n C-n C-n C-n C-n C-n
C-n C-n C-e C-x C-e C-x C-e C-x C-e C-e C-f C-p C-p
C-p C-p C-p C-p C-p C-p C-p M-m C-p C-f C-p C-s C-w
C-w C-w C-s C-s C-n C-a C-n C-n C-n C-n C-n C-n C-n
C-n C-e C-n C-e C-x C-e C-x C-e C-n C-p C-n C-n C-e
C-p C-e C-p C-p C-e C-p C-p C-p C-p C-e C-p C-e C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-e C-p C-e M-x e <backspace>
b u g - r e <tab> <tab> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> e m a <tab> b <tab> C-g M-x r e p o <tab>
r <tab> <tab> <return>

Recent messages:
(buffer-string) =
HTTP/1.1 204 No Content
Content-Length: 0
Content-Type: text/html; charset=UTF-8
Server: TornadoServer/2.2
 [2 times]
byte-code: End of buffer [2 times]
Making completion list...
Quit
Making completion list... [2 times]

Load-path shadows:
/usr/share/emacs/24.1.50/site-lisp/debian-startup hides
/usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs/24.1.50/site-lisp/cmake-data/cmake-mode hides
/usr/share/emacs/site-lisp/cmake-mode
/usr/share/emacs/site-lisp/rst hides /usr/share/emacs/24.1.50/lisp/textmodes/rst

Features:
(shadow sort mail-extr emacsbug message format-spec rfc822 mml mml-sec
mm-decode mm-bodies mm-encode mailabbrev gmm-utils mailheader sendmail
help-mode view multi-isearch mail-utils network-stream starttls url-http
tls mail-parse rfc2231 rfc2047 rfc2045 ietf-drums url-gw url-cache
url-auth url url-proxy url-privacy url-expand url-methods url-history
url-cookie url-domsuf url-util url-parse auth-source eieio byte-opt
bytecomp byte-compile cconv macroexp assoc gnus-util password-cache
url-vars mm-util mail-prsvr mailcap python-21 python easymenu comint
regexp-opt ansi-color ring time-date tooltip ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image fringe
lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer loaddefs button faces cus-face files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty emacs)





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#11469: [PATCH] Fix bug #11469; propagate url-request-* vars properly
  2012-05-14 11:31 bug#11469: 24.1.50; url-retrieve with PUT method fails every two times Takafumi Arakaki
@ 2012-12-20 20:13 ` Takafumi Arakaki
  2012-12-22  2:59   ` Chong Yidong
  0 siblings, 1 reply; 3+ messages in thread
From: Takafumi Arakaki @ 2012-12-20 20:13 UTC (permalink / raw)
  To: 11469

[-- Attachment #1: Type: text/plain, Size: 166 bytes --]

Hi,

This is a patch to fix bug #11469
24.1.50; url-retrieve with PUT method fails every two times
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11469

Best,
Takafumi

[-- Attachment #2: 0001-Fix-bug-11469-propagate-url-request-vars-properly.patch --]
[-- Type: application/octet-stream, Size: 1297 bytes --]

From 3d1e5c7dd14d5b47749b9a1c727deb64abcb5bba Mon Sep 17 00:00:00 2001
From: Takafumi Arakaki <aka.tkf@gmail.com>
Date: Thu, 20 Dec 2012 20:06:00 +0100
Subject: [PATCH] Fix bug #11469; propagate url-request-* vars properly

url-retrieve with PUT method failed every two times prior to this
patch, as url-request-method was not propagated to the nested call
of url-http.
---
 lisp/url/url-http.el |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el
index 73d53e0..1f705f6 100644
--- a/lisp/url/url-http.el
+++ b/lisp/url/url-http.el
@@ -890,8 +890,11 @@ should be shown to the user."
 		 (url-http-activate-callback)
 	       ;; Call `url-http' again if our connection expired.
 	       (erase-buffer)
-	       (url-http url-current-object url-callback-function
-			 url-callback-arguments (current-buffer))))
+               (let ((url-request-method url-http-method)
+                     (url-request-extra-headers url-http-extra-headers)
+                     (url-request-data url-http-data))
+                 (url-http url-current-object url-callback-function
+                           url-callback-arguments (current-buffer)))))
 	    ((url-http-parse-headers)
 	     (url-http-activate-callback))))))
 
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#11469: [PATCH] Fix bug #11469; propagate url-request-* vars properly
  2012-12-20 20:13 ` bug#11469: [PATCH] Fix bug #11469; propagate url-request-* vars properly Takafumi Arakaki
@ 2012-12-22  2:59   ` Chong Yidong
  0 siblings, 0 replies; 3+ messages in thread
From: Chong Yidong @ 2012-12-22  2:59 UTC (permalink / raw)
  To: Takafumi Arakaki; +Cc: 11469-done

Takafumi Arakaki <aka.tkf@gmail.com> writes:

> This is a patch to fix bug #11469
> 24.1.50; url-retrieve with PUT method fails every two times
> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11469

Thank you.  Committed to trunk.





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-12-22  2:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-14 11:31 bug#11469: 24.1.50; url-retrieve with PUT method fails every two times Takafumi Arakaki
2012-12-20 20:13 ` bug#11469: [PATCH] Fix bug #11469; propagate url-request-* vars properly Takafumi Arakaki
2012-12-22  2:59   ` Chong Yidong

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).