Allow to override UserAgent

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
This commit is contained in:
Laurent Arnoud
2019-04-21 21:47:38 +02:00
parent 599f5c1723
commit b06d1f6a02
3 changed files with 11 additions and 6 deletions

1
fm.h
View File

@@ -935,6 +935,7 @@ global int w3m_dump init(0);
global int w3m_halfload init(FALSE);
global Str header_string init(NULL);
global int override_content_type init(FALSE);
global int override_user_agent init(FALSE);
#ifdef USE_COLOR
global int useColor init(TRUE);