Skip to content
GitLab
About GitLab
GitLab: the DevOps platform
Explore GitLab
Install GitLab
How GitLab compares
Get started
GitLab docs
GitLab Learn
Pricing
Talk to an expert
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Projects
Groups
Snippets
Sign up now
Login
Sign in / Register
Toggle navigation
Menu
Open sidebar
Frank Tobin
Nebulo
Commits
7f661900
Commit
7f661900
authored
Mar 22, 2020
by
Daniel Wolf
Browse files
Ignore invalid URLs in the speed test
parent
e0611d2e
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/com/frostnerd/smokescreen/util/speedtest/DnsSpeedTest.kt
View file @
7f661900
...
...
@@ -10,17 +10,16 @@ import com.frostnerd.dnstunnelproxy.UpstreamAddress
import
com.frostnerd.encrypteddnstunnelproxy.HttpsDnsServerInformation
import
com.frostnerd.encrypteddnstunnelproxy.ServerConfiguration
import
com.frostnerd.encrypteddnstunnelproxy.tls.TLSUpstreamAddress
import
okhttp3.Dns
import
okhttp3.OkHttpClient
import
okhttp3.Request
import
okhttp3.*
import
okhttp3.HttpUrl.Companion.toHttpUrl
import
okhttp3.RequestBody.Companion.toRequestBody
import
okhttp3.Response
import
okhttp3.internal.closeQuietly
import
org.minidns.dnsmessage.DnsMessage
import
org.minidns.dnsmessage.Question
import
org.minidns.record.Record
import
java.io.DataInputStream
import
java.io.DataOutputStream
import
java.lang.IllegalArgumentException
import
java.net.*
import
java.util.concurrent.ConcurrentHashMap
import
java.util.concurrent.TimeUnit
...
...
@@ -116,7 +115,14 @@ class DnsSpeedTest(val server: DnsServerInformation<*>,
private
fun
testHttps
(
config
:
ServerConfiguration
):
Int
?
{
val
msg
=
createTestDnsPacket
()
val
url
:
URL
=
config
.
urlCreator
.
createUrl
(
msg
,
config
.
urlCreator
.
address
)
log
(
"Using URL: $url"
)
try
{
url
.
toString
().
toHttpUrl
()
log
(
"Using URL: $url"
)
}
catch
(
ignored
:
IllegalArgumentException
)
{
log
(
"Invalid URL: $url"
)
return
null
}
val
requestBuilder
=
Request
.
Builder
().
url
(
url
)
if
(
config
.
requestHasBody
)
{
val
body
=
config
.
bodyCreator
!!
.
createBody
(
msg
,
config
.
urlCreator
.
address
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment