unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Ivan Shmakov <ivan@siamics.net>
To: 17958@debbugs.gnu.org
Subject: bug#17958: eww-submit mishandles the POST method, no action forms
Date: Sun, 06 Jul 2014 18:45:05 +0000	[thread overview]
Message-ID: <8738eeconi.fsf@violet.siamics.net> (raw)

Package:  emacs

	As evidenced with the form at [1], EWW currently (as of
	36634f669f2c) mishandles the case where an HTML form uses
	‘method="POST"’ but specifies no ‘action’ attribute.  Namely,
	instead of interpreting missing ‘action’ as meaning “this very
	same URI”, EWW uses the URI with the ‘path’ component discarded.

	Granted, missing ‘action’ is special-cased for GET forms:

  1034		(if (cdr (assq :action form))
  1035		    (shr-expand-url (cdr (assq :action form))
  1036				    eww-current-url)
  1037		  eww-current-url)

	While POST forms get no such treatment:

  1030		  (eww-browse-url (shr-expand-url (cdr (assq :action form))
  1031						  eww-current-url)))

	However, I believe that the real culprit is shr-expand-url,
	which mishandles the nil ‘uri’ case:

(mapcar (lambda (x) (shr-expand-url x "http://example.com/welcome/"))
        '("hello" "/world" nil))
;; ⇒
("http://example.com/welcome/hello"
 "http://example.com/world"
 "http://example.com")

	My expectation for the last result would be the ‘base’ argument
	unchanged (i. e., http://example.com/welcome/.)

	Thus, I suggest changing shr-expand-url to return not the 0th
	element of the (parsed) ‘base’ (see below), but the 3rd.

   596	  (cond ((or (not url)
   597		     (not base)
   598		     (string-match "\\`[a-z]*:" url))
   599		 ;; Absolute URL.
   600		 (or url (car base)))

[1] https://tools.wmflabs.org/guc/?user=2001:db8:1337::cafe

-- 
FSF associate member #7257	http://boycottsystemd.org/





             reply	other threads:[~2014-07-06 18:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-06 18:45 Ivan Shmakov [this message]
2014-08-14 18:50 ` bug#17958: SHR: base handling broken (shr-parse-base, shr-expand-url) Ivan Shmakov
2014-11-04 16:44   ` Ted Zlatanov
2014-11-13 18:41   ` Lars Magne Ingebrigtsen

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=8738eeconi.fsf@violet.siamics.net \
    --to=ivan@siamics.net \
    --cc=17958@debbugs.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.
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).