[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Changing a user agent string
Kinoshita-san, could you please look at the 2]-th section?
(木下さん、2] 項をご覧になっていただけませんか? w3m-user-agent
を nil や空白文字にしても w3m が User-Agent ヘッダーを送信する
ことを止めることができません。そういう需要があるかどうかは別の
話として。)
In [emacs-w3m:12876]
On Wed, 17 Jan 2018 12:09:23 -0500, Boruch Baum wrote:
> Attached is the patch.
Thanks. I verified it works fine.
> 1] The feature is currently implemented only for `w3m-reload-this-page',
> but shouldn't it somehow also implemented for `w3m-goto-url',
> `w3m-goto-url-new-session', and maybe even `w3m-reload-all'pages'?
Well, there might be a web site that is unable to open unless
sending a fake user-agent (that's why IE calles itself Mozilla).
So, not only `w3m-reload-this-page' but also the other commands
would have to support the feature as you say.
In addition, such a page might require the user-agent faking for
also visiting links in it. In such a case, the user-agent value
will need to be semi-permanent. I mean making it session-local,
but if impossible buffer-local. Oh, that might only be able to
make the code dirty.
Another idea is to introduce an alist that holds a list of a url-
regexp and a user-agent pairs. It overrides the default user-agent
if a regexp matches the url to visit.
> 1.1] Do you want it done the same way, using just `C-u'? Or `C-u C-u'
> in order to keep it consistent? I'm not sure what would be less
> confusing to users.
I think `C-u C-u' (i.e. `M-16') is good because it would be rare
to send a fake user-agent and it can leave 0~15 for the future use.
> 1.2] Are there other functions that should implement this feature?
+ w3m-view-this-url(-new-session)
Though `C-u C-u' is already assigned for a certain purpose, it
can be diverted maybe.
> 2] I came across an "issue" in that w3m seems to insist on ALWAYS
> sending a user-agent string. My work-around was to push a "?" as a
> dummy user-agent string when `w3m-add-user-agent' is nil. However,
> this itself may be identifiable. Maybe an alternative work-around
> would be better? Possibly "error" or "n/a".
> 2.1] I'm considering submitting a bug report to w3m. However, I
> suspect that it would carry more clout if it came from the
> emacs-w3m project rather than from me.
Confirmed. I didn't know w3m sends a user-agent no matter what.
I think it would be worth asking the w3m team for modifying it,
but it will take time to spread the new version to users even if
it is done. So, I think any string is ok for the `no user-agant'
case for the moment.
> 3] When looking at item #2, I came across `w3m-add-referer'. Do I
> understand correctly that the default always suppresses referers when
> using https? Now that the project is encouraging https as a default,
> should that behavior continue?
Oh, I believe it should send a refer to https sites as well by
default.
> 4] I added an option for three prefix arguments, ie `C-u C-u C-u' to
> cover the cases of someone wanting a new user-agent string but not
> necessarily wanting to clear form and post data.
It would be useful even if it is a rare case.
> 5] The feature is coded in such a way that when called directly
> interactively, it will permanently change the user-agent string, but
> otherwise the change will only apply for the current operation.
I see.
Thanks again for your precise work.