mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
Use context.WithTimeout instead of transport.Deadline
* The field was removed in,
11ed51af43
This commit is contained in:
parent
ab4bd77cb4
commit
fea9df7540
1 changed files with 3 additions and 4 deletions
|
@ -74,14 +74,13 @@ func handler(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if urlFetchTimeout != 0 {
|
||||||
|
context_, _ = context.WithTimeout(context_, urlFetchTimeout)
|
||||||
|
}
|
||||||
// Use urlfetch.Transport directly instead of urlfetch.Client because we
|
// Use urlfetch.Transport directly instead of urlfetch.Client because we
|
||||||
// want only a single HTTP transaction, not following redirects.
|
// want only a single HTTP transaction, not following redirects.
|
||||||
transport := urlfetch.Transport{
|
transport := urlfetch.Transport{
|
||||||
Context: context_,
|
Context: context_,
|
||||||
// Despite the name, Transport.Deadline is really a timeout and
|
|
||||||
// not an absolute deadline as used in the net package. In
|
|
||||||
// other words it is a time.Duration, not a time.Time.
|
|
||||||
Deadline: urlFetchTimeout,
|
|
||||||
}
|
}
|
||||||
resp, err := transport.RoundTrip(fr)
|
resp, err := transport.RoundTrip(fr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue