Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
matrix-media-repo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
matrix-media-repo
Commits
764c5b76
Commit
764c5b76
authored
1 year ago
by
Travis Ralston
Browse files
Options
Downloads
Patches
Plain Diff
Clean up URL preview http code
parent
9ac19396
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
url_previewing/u/http.go
+2
-3
2 additions, 3 deletions
url_previewing/u/http.go
with
2 additions
and
3 deletions
url_previewing/u/http.go
+
2
−
3
View file @
764c5b76
...
...
@@ -25,7 +25,6 @@ func doHttpGet(urlPayload *m.UrlPayload, languageHeader string, ctx rcontext.Req
dialer
:=
&
net
.
Dialer
{
Timeout
:
time
.
Duration
(
ctx
.
Config
.
TimeoutSeconds
.
UrlPreviews
)
*
time
.
Second
,
KeepAlive
:
time
.
Duration
(
ctx
.
Config
.
TimeoutSeconds
.
UrlPreviews
)
*
time
.
Second
,
DualStack
:
true
,
}
dialContext
:=
func
(
ctx2
context
.
Context
,
network
,
addr
string
)
(
conn
net
.
Conn
,
e
error
)
{
...
...
@@ -48,7 +47,7 @@ func doHttpGet(urlPayload *m.UrlPayload, languageHeader string, ctx rcontext.Req
DialContext
:
dialContext
,
TLSClientConfig
:
&
tls
.
Config
{
InsecureSkipVerify
:
true
},
// Based on https://github.com/matrix-org/gomatrixserverlib/blob/51152a681e69a832efcd934b60080b92bc98b286/client.go#L74-L90
DialTLS
:
func
(
network
,
addr
string
)
(
net
.
Conn
,
error
)
{
DialTLS
Context
:
func
(
ctx2
context
.
Context
,
network
,
addr
string
)
(
net
.
Conn
,
error
)
{
rawconn
,
err
:=
net
.
Dial
(
network
,
addr
)
if
err
!=
nil
{
return
nil
,
err
...
...
@@ -65,8 +64,8 @@ func doHttpGet(urlPayload *m.UrlPayload, languageHeader string, ctx rcontext.Req
},
}
client
=
&
http
.
Client
{
Transport
:
tr
,
Timeout
:
time
.
Duration
(
ctx
.
Config
.
TimeoutSeconds
.
UrlPreviews
)
*
time
.
Second
,
Transport
:
tr
,
}
}
else
{
client
=
&
http
.
Client
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment