Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mtproto_proxy
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
mtproto_proxy
Commits
438c770c
Unverified
Commit
438c770c
authored
Aug 26, 2019
by
Sergey Prokhorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use httpc ipv4 options only on OTP 21+
parent
2a5d6463
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
mtp_config.erl
src/mtp_config.erl
+9
-3
No files found.
src/mtp_config.erl
View file @
438c770c
...
...
@@ -257,14 +257,20 @@ update_ip([Url | Fallbacks]) ->
update_ip
([])
->
error
(
ip_lookup_failed
).
-
ifdef
(
OTP_VERSION
).
%% XXX: ipfamily only works on OTP >= 20.3.4; see OTP 2dc08b47e6a5ea759781479593c55bb5776cd828
%% Enable it for OTP 21+ for simplicity
-
define
(
OPTS
,
[{
socket_opts
,
[{
ipfamily
,
inet
}]}]).
-
else
.
-
define
(
OPTS
,
[]).
-
endif
.
http_get
(
Url
)
->
{
ok
,
Vsn
}
=
application
:
get_key
(
mtproto_proxy
,
vsn
),
UserAgent
=
"MTProtoProxy/"
++
Vsn
++
" (+https://github.com/seriyps/mtproto_proxy)"
,
Headers
=
[{
"User-Agent"
,
UserAgent
}],
%% XXX: ipfamily only works on OTP >= 20.3.4; see OTP 2dc08b47e6a5ea759781479593c55bb5776cd828
{
ok
,
{{_,
200
,
_},
_,
Body
}}
=
httpc
:
request
(
get
,
{
Url
,
Headers
},
[{
timeout
,
3000
}],
[{
socket_opts
,
[{
ipfamily
,
inet
}]}]),
httpc
:
request
(
get
,
{
Url
,
Headers
},
[{
timeout
,
3000
}],
?
OPTS
),
{
ok
,
Body
}.
random_choice
(
L
)
->
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment