Skip to content

Allow to override UserAgent#113

Merged
tats merged 1 commit into
tats:masterfrom
spk:allow-override-user-agent
Apr 22, 2019
Merged

Allow to override UserAgent#113
tats merged 1 commit into
tats:masterfrom
spk:allow-override-user-agent

Conversation

@spk

@spk spk commented Apr 21, 2019

Copy link
Copy Markdown
Contributor

Hello,

Adding on command line the user agent add a duplicate header:

./w3m -header "User-Agent: Mozilla" http://localhost:9999

GET / HTTP/1.0
User-Agent: w3m/0.5.3+git20190105
Accept: text/html, text/*;q=0.5, image/*, application/*, message/*, x-scheme-handler/*, audio/*, video/*, inode/*
Accept-Encoding: gzip, compress, bzip, bzip2, deflate
Accept-Language: en;q=1.0
Host: localhost:9999
User-Agent: Mozilla

As a result most server will take the first given; the default
w3m_version or the one defined on config user_agent

With this patch we can now override User-Agent from command line

Cheers,
Laurent

Adding on command line the user agent add a duplicate header:

```
./w3m -header "User-Agent: Mozilla" http://localhost:9999

GET / HTTP/1.0
User-Agent: w3m/0.5.3+git20190105
Accept: text/html, text/*;q=0.5, image/*, application/*, message/*, x-scheme-handler/*, audio/*, video/*, inode/*
Accept-Encoding: gzip, compress, bzip, bzip2, deflate
Accept-Language: en;q=1.0
Host: localhost:9999
Pragma: no-cache
Cache-control: no-cache
User-Agent: Mozilla
```

As a result most server will take the first given; the default
w3m_version or the one defined on config `user_agent`

With this patch we can now override `User-Agent` from command line
@tats

tats commented Apr 22, 2019

Copy link
Copy Markdown
Owner

w3m_version or the one defined on config user_agent
With this patch we can now override User-Agent from command line

The config value can be set by -o from command line,
e.g. w3m -o user_agent=Mozilla.

@spk

spk commented Apr 22, 2019

Copy link
Copy Markdown
Contributor Author

The config value can be set by -o from command line,
e.g. w3m -o user_agent=Mozilla.

Cool thanks for the info, but don't you find its a strange behavior ? I've checked with curl that have the same config/header options and you can override the user agent with:

curl --header "User-Agent: w3m" localhost:9999

GET / HTTP/1.1
Host: localhost:9999
Accept: */*
Referer:
User-Agent: w3m

@tats
tats merged commit b0509ce into tats:master Apr 22, 2019
@tats

tats commented Apr 22, 2019

Copy link
Copy Markdown
Owner

Anyway, preventing User-Agent twice is reasonable.

Merged, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants