mattermost/services/httpservice
Eli Young 17a7d5ce29
[MM-31899] Use a custom user-agent when previewing links (#17186)
* Use a custom user-agent when previewing links

Many websites block requests made with Go's default user-agent. We had
previous special-cased Twitter links to use a nonstandard user-agent.
This makes that behavior apply everywhere and also customizes the
user-agent to belong specifically to Mattermost.

* Correctly use custom transport for link previews

This allows us to use the custom user-agent defined in
services/httpservice/client.go.

* Stop leaking server version in custom user-agent

Since the custom user-agent is now used when previewing links, exposing
the server version could provide a vector for a malicious actor to
gather information about private deployments. To avoid this, we switch
to a generic string.

* Remove extraneous Transport creation

MakeClient already creates a transport for us, so this is unnecessary.

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-04-12 09:30:48 -04:00
..
client.go [MM-31899] Use a custom user-agent when previewing links (#17186) 2021-04-12 09:30:48 -04:00
client_test.go Fix initialism errors (PR-2) (#17032) 2021-04-03 12:43:22 +05:30
httpservice.go Use different user-agent for twitter links (#16210) 2020-11-17 14:48:51 +01:00
transport.go Consistent license message for all the go files (#13235) 2019-11-29 12:59:40 +01:00