fix(oohelperd): reduce differences with legacy helper (#504)
Part of https://github.com/ooni/probe/issues/1707
This commit is contained in:
parent
3cb782f0a2
commit
985c1ba761
3 changed files with 18 additions and 3 deletions
|
|
@ -30,7 +30,11 @@ func HTTPDo(ctx context.Context, config *HTTPConfig) {
|
|||
defer config.Wg.Done()
|
||||
req, err := http.NewRequestWithContext(ctx, "GET", config.URL, nil)
|
||||
if err != nil {
|
||||
config.Out <- CtrlHTTPResponse{Failure: newfailure(err)}
|
||||
config.Out <- CtrlHTTPResponse{ // fix: emit -1 like the old test helper does
|
||||
BodyLength: -1,
|
||||
Failure: newfailure(err),
|
||||
StatusCode: -1,
|
||||
}
|
||||
return
|
||||
}
|
||||
// The original test helper failed with extra headers while here
|
||||
|
|
@ -45,7 +49,11 @@ func HTTPDo(ctx context.Context, config *HTTPConfig) {
|
|||
}
|
||||
resp, err := config.Client.Do(req)
|
||||
if err != nil {
|
||||
config.Out <- CtrlHTTPResponse{Failure: newfailure(err)}
|
||||
config.Out <- CtrlHTTPResponse{ // fix: emit -1 like old test helper does
|
||||
BodyLength: -1,
|
||||
Failure: newfailure(err),
|
||||
StatusCode: -1,
|
||||
}
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
|
|
|||
Loading…
Reference in a new issue