[pmwiki-users] Re: Pmwiki emacs mode not handling redirects
chr at home.se
chr at home.se
Wed Sep 28 10:16:44 CDT 2005
On Thu, 29 Sep 2005, Robin wrote:
> I have my wiki set up on '/', and a so request to
> http://www.kallisti.net.nz/ results in a 301 redirect to
> http://www.kallisti.net.nz/Main/HomePage. However, if I open that URI
> from within emacs, it requests:
> which results in a redirect to:
> which the emacs mode doesn't follow.
> If I tell it to open
> then it works fine, because pmwiki sees the request. However, this isn't
> the nicest way of doing things. Is there a better workaround for this?
> If the mode requested .../Main/HomePage?action=source then that would do
> the trick.
> ('...' equals my hostname so I don't have to keep typing it:)
I think you're looking for this:
(The information was previously in pmwiki-mode.el and the change log, but
now I've also copied it to a separate page).
> Also, it would be nice if the emacs http-get set a user-agent string, just
> for logging purposes (but that's not really a requirement)
That shouldn't be too difficult... try messing with the function
pmwiki-edit in pmwiki-mode.el. To be a little bit more specific, modify it
(when (string-match pmwiki-password-URI-pattern page-uri)
(setq user-and-password (base64-encode-string
(match-string 1 page-uri)))
(setq page-uri (replace-regexp-in-string
"http://.*?:.*?@" "http://" page-uri))
(add-to-list 'headers (list "Authorization"
(concat "Basic " user-and-password))))
;; New line below this comment
(add-to-list 'headers (list "User-Agent" "Emacs pmwiki-mode"))
(http-get (concat page-uri "&action=source") ; Source URI
headers ; headers
nil ; ?
http-ver ; nil -> 1.0
(pmwiki-link-to-name link) ; output buffer
content-type) ) ; typically nil
Please note that I haven't tested the above... nor do I have a clue if the
string "User-Agent" is correct... It might work though ;-)
PS. The above is based on the latest CVS version of pmwiki-mode. Please
use that since I've been too lazy to provide a release in a long while.
(I find using CVS so convenient)
Christian Ridderström, +46-8-768 39 44 http://www.md.kth.se/~chr
More information about the pmwiki-users