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

[BUG] in url-construction in `w3m-form-submit'



Hi List,

[repost from emacs-help]

* Steps to reproduce:

1. Create an account for the PicoLisp Wiki
   goto
   http://picolisp.com/5000/-2.html?*ID=$login
   enter name and password and click OK

2. Login with standalone w3m

   Goto

#+begin_src sh
   $ w3m http://wiki.picolisp.com
#+end_src

   and login via w3m - it works

3. Repeat (2.) with emacs-w3m -> error:

#+begin_quote Location:
   http://picolisp.com/56352250583933977~!start?*Menu=+3&*Tab=+1&*ID= Cannot
   retrieve URL: http://picolisp.com/56352250583933977~!start?*Menu=+3&*Tab=
   +1&*ID= (exit status: 0)
   -------------------------------------------------------------------------
   -------------------------------------------------------------------------
   Header information W3m-current-url:
   http://picolisp.com/56352250583933977~!start?*Menu=+3&*Tab=+1&*ID=
   W3m-document-charset: US-ASCII
#+end_quote


* Problem
url is incomplete:

,--------------------------------------
| http://picolisp.com/56352250583933977...
`--------------------------------------

here is the beginning of the html source of the login page:

#+begin_src html
  <!DOCTYPE html>
  <html lang="en">
  <head>
  <title>PicoLisp Wiki</title>
  <base href="http://picolisp.com/52313/"/>
  [...snip...]
  <li class="act1"><a href="56352250583933977~!start?*Menu=+3&*Tab=+1&*ID="
  title="--&gt;">Home</a></li>
#+end_src

url should be

,------------------------------------------------
| http://picolisp.com/52313/56352250583933977 ...
`------------------------------------------------

and looks like that in stand-alone w3m.

* Bug

in `w3m-form-submit' in w3m-form.el the url-handling ignores the base href:

#+begin_src emacs-lisp
  (defun w3m-form-submit (form &optional id name value new-session download)
    [...snip...]
      (let* ((orig-url w3m-current-url)
             (url (or (w3m-form-action form)
                      (if (string-match "\\?" w3m-current-url)
                          (substring w3m-current-url 0 (match-beginning 0))
                        w3m-current-url)))) [...]
#+end_src

This line

,--------------------------------
| (url (or (w3m-form-action form)
`--------------------------------

should be changed to something that treats the href in the form as relative,
when <base href=...> is given, and concatenates it with its base.

-- 
cheers,
Thorsten