mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
Return after bad request
This commit is contained in:
parent
81931fa8e7
commit
bdbabe5e0c
1 changed files with 3 additions and 2 deletions
|
@ -118,8 +118,10 @@ func proxyPolls(ctx *BrokerContext, w http.ResponseWriter, r *http.Request) {
|
||||||
w.WriteHeader(http.StatusBadRequest)
|
w.WriteHeader(http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if string(body) != id { // Mismatched IDs!
|
if string(body) != id {
|
||||||
|
log.Println("Mismatched IDs!")
|
||||||
w.WriteHeader(http.StatusBadRequest)
|
w.WriteHeader(http.StatusBadRequest)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
log.Println("Received snowflake: ", id)
|
log.Println("Received snowflake: ", id)
|
||||||
// Wait for a client to avail an offer to the snowflake, or timeout if nil.
|
// Wait for a client to avail an offer to the snowflake, or timeout if nil.
|
||||||
|
@ -162,7 +164,6 @@ func clientOffers(ctx *BrokerContext, w http.ResponseWriter, r *http.Request) {
|
||||||
case answer := <-snowflake.answerChannel:
|
case answer := <-snowflake.answerChannel:
|
||||||
log.Println("Client: Retrieving answer")
|
log.Println("Client: Retrieving answer")
|
||||||
w.Write(answer)
|
w.Write(answer)
|
||||||
|
|
||||||
case <-time.After(time.Second * ClientTimeout):
|
case <-time.After(time.Second * ClientTimeout):
|
||||||
log.Println("Client: Timed out.")
|
log.Println("Client: Timed out.")
|
||||||
w.WriteHeader(http.StatusGatewayTimeout)
|
w.WriteHeader(http.StatusGatewayTimeout)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue