PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: fortio/fortio (go)

Issue:
Any HTTP Client sending error is logged as status 400 response
https://github.com/fortio/fortio/blob/4a325b93146c7faf5d7ff5a327d3c86abceb141f/fhttp/http_client.go#L377

Why is any HTTP client sending error added in the statistics as a status 400 response? 

For instance if I run a test over an http endpoint expecting an httpS endpoint, the client fail negotiating the encryption but all the requests are logged as a status 400 response from the server, hiding the real problem, and also dirtying the statistics.

Pull request:
Use -1 instead of http.StatusBadRequest for std client go err
Fixes #510 

Patch:
diff --git a/fhttp/http_client.go b/fhttp/http_client.go
index a075925..c0d69e0 100644
--- a/fhttp/http_client.go
+++ b/fhttp/http_client.go
@@ -374,7 +374,7 @@ func (c *Client) Fetch() (int, []byte, int) {
 	resp, err := c.client.Do(c.req)
 	if err != nil {
 		log.Errf("[%d] Unable to send %s request for %s : %v", c.id, c.req.Method, c.url, err)
-		return http.StatusBadRequest, []byte(err.Error()), 0
+		return -1, []byte(err.Error()), 0
 	}
 	var data []byte
 	if log.LogDebug() {


Test patch:
diff --git a/fhttp/http_test.go b/fhttp/http_test.go
index 0047876..444b8c1 100644
--- a/fhttp/http_test.go
+++ b/fhttp/http_test.go
@@ -709,8 +709,8 @@ func TestInvalidRequest(t *testing.T) {
 	client.ChangeURL(" http://bad.url.with.space.com/") // invalid url
 	// should not crash (issue #93), should error out
 	code, _, _ := client.Fetch()
-	if code != http.StatusBadRequest {
-		t.Errorf("Got %d code while expecting bad request (%d)", code, http.StatusBadRequest)
+	if code != -1 {
+		t.Errorf("Got %d code while expecting -1 (local error)", code)
 	}
 	o.URL = client.url
 	c2, err := NewStdClient(&o)
@@ -1369,9 +1369,9 @@ func TestInsecureRequest(t *testing.T) {
 		code       int  // expected code
 	}{
 		{false, true, http.StatusOK},
-		{false, false, http.StatusBadRequest},
+		{false, false, -1},
 		{true, true, http.StatusOK},
-		{true, false, http.StatusBadRequest},
+		{true, false, -1},
 	}
 	for _, tst := range tests {
 		o := HTTPOptions{
@@ -1400,9 +1400,9 @@ func TestInsecureRequestWithResolve(t *testing.T) {
 		code       int  // expected code
 	}{
 		{false, true, http.StatusOK},
-		{false, false, http.StatusBadRequest},
+		{false, false, -1},
 		{true, true, http.StatusOK},
-		{true, false, http.StatusBadRequest},
+		{true, false, -1},
 	}
 	for _, tst := range tests {
 		o := HTTPOptions{