VictoriaMetrics/lib/promscrape
Artem Fetishev ac128d268f
lib/promscrape: Fix TestClientProxyReadOk flaky test (#7173)
This PR fixes #7062

For hijacked connections, one has to read from the connection buffer,
but still write directly to the connection. Otherwise, when reading
directly from such connections, the first byte may be lost. This, in
turn corrupts the ClientHello TLS handshake message and when the backend
server receives it, it closes the connection and reports the following
error in the log:

```
http: TLS handshake error from 127.0.0.1:33150: tls: first record does not look
like a TLS handshake
```

The first byte may be lost because underlying HTTP request handler may
read it from the connection and put it into the buffer. As the result,
subsequent connection reads won't see that byte.

-   See: https://github.com/golang/go/issues/27408
-   The fix is taken from : https://github.com/k3s-io/k3s/pull/6216

### Checklist

The following checks are **mandatory**:

- [x] My change adheres [VictoriaMetrics contributing
guidelines](https://docs.victoriametrics.com/contributing/).

Signed-off-by: Artem Fetishev <rtm@victoriametrics.com>
(cherry picked from commit c1cd3e85a7)
2024-10-04 10:42:52 +02:00
..
discovery feature: [vmagent] Add service discovery support for OVH Cloud VPS and dedicated server (#6160) 2024-09-30 15:06:14 +02:00
discoveryutils lib: consistently use regexp.Regexp.ReplaceAllLiteralString instead of regexp.Regexp.ReplaceAllString in places where the replacement cannot contain matching group placeholders 2024-07-17 12:57:43 +02:00
testdata lib/promscrape: disable support for service discovery and metrics scrape via http2 2023-07-06 16:04:31 -07:00
client_test.go lib/promscrape: Fix TestClientProxyReadOk flaky test (#7173) 2024-10-04 10:42:52 +02:00
client.go lib/promscrape: fixes proxy autorization (#6783) 2024-08-19 22:50:39 +02:00
config_test.go lib/promrelabel: follow-up for 8958cecad6 2024-08-27 15:44:07 +02:00
config_timing_test.go lib/promscrape: optimize service discovery speed 2022-11-29 21:26:23 -08:00
config.go feature: [vmagent] Add service discovery support for OVH Cloud VPS and dedicated server (#6160) 2024-09-30 15:06:14 +02:00
relabel_debug.go app/vmselect: small cleanup after 4f3f9950d0 2023-05-09 22:45:02 -07:00
scraper.go feature: [vmagent] Add service discovery support for OVH Cloud VPS and dedicated server (#6160) 2024-09-30 15:06:14 +02:00
scrapework_test.go lib/promscrape: use prompbmarshal.MustParsePromMetrics function at parseData() test function 2024-07-03 16:10:37 +02:00
scrapework_timing_test.go all: fix golangci-lint(revive) warnings after 0c0ed61ce7 2024-04-03 03:00:45 +03:00
scrapework.go lib/promscrape: follow-up for 1e83598be3 2024-07-16 12:38:41 +02:00
targetstatus.go lib/promscrape: show only unhealthy targets if show_only_unhealthy filter is enabled (#6960) 2024-09-24 16:58:16 +02:00
targetstatus.qtpl lib/promscrape: follow-up for 1e83598be3 2024-07-16 12:38:41 +02:00
targetstatus.qtpl.go lib/promscrape: follow-up for 1e83598be3 2024-07-16 12:38:41 +02:00