diff options
author | djm <> | 2025-05-22 06:40:26 +0000 |
---|---|---|
committer | djm <> | 2025-05-22 06:40:26 +0000 |
commit | 086d2a53e6ce2e3a7125250f1af431489326b8eb (patch) | |
tree | 8fafae550bb4d4fb055513d87b182729a10aa589 /src | |
parent | dada345a76df293dac396549e9710b885fe79c98 (diff) | |
download | openbsd-086d2a53e6ce2e3a7125250f1af431489326b8eb.tar.gz openbsd-086d2a53e6ce2e3a7125250f1af431489326b8eb.tar.bz2 openbsd-086d2a53e6ce2e3a7125250f1af431489326b8eb.zip |
Fix HTTP CONNECT proxy support to not treat responses like
"HTTP/1.0 200poo" as success; patch from Spiros Thanasoulas
Diffstat (limited to 'src')
-rw-r--r-- | src/usr.bin/nc/socks.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/usr.bin/nc/socks.c b/src/usr.bin/nc/socks.c index 684d6062d3..1f1fb96e2a 100644 --- a/src/usr.bin/nc/socks.c +++ b/src/usr.bin/nc/socks.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: socks.c,v 1.33 2025/05/21 09:14:01 djm Exp $ */ | 1 | /* $OpenBSD: socks.c,v 1.34 2025/05/22 06:40:26 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 1999 Niklas Hallqvist. All rights reserved. | 4 | * Copyright (c) 1999 Niklas Hallqvist. All rights reserved. |
@@ -387,16 +387,16 @@ socks_connect(const char *host, const char *port, | |||
387 | /* Read status reply */ | 387 | /* Read status reply */ |
388 | proxy_read_line(proxyfd, buf, sizeof(buf)); | 388 | proxy_read_line(proxyfd, buf, sizeof(buf)); |
389 | if (proxyuser != NULL && | 389 | if (proxyuser != NULL && |
390 | (strncmp(buf, "HTTP/1.0 407 ", 12) == 0 || | 390 | (strncmp(buf, "HTTP/1.0 407 ", 13) == 0 || |
391 | strncmp(buf, "HTTP/1.1 407 ", 12) == 0)) { | 391 | strncmp(buf, "HTTP/1.1 407 ", 13) == 0)) { |
392 | if (authretry > 1) { | 392 | if (authretry > 1) { |
393 | fprintf(stderr, "Proxy authentication " | 393 | fprintf(stderr, "Proxy authentication " |
394 | "failed\n"); | 394 | "failed\n"); |
395 | } | 395 | } |
396 | close(proxyfd); | 396 | close(proxyfd); |
397 | goto again; | 397 | goto again; |
398 | } else if (strncmp(buf, "HTTP/1.0 200 ", 12) != 0 && | 398 | } else if (strncmp(buf, "HTTP/1.0 200 ", 13) != 0 && |
399 | strncmp(buf, "HTTP/1.1 200 ", 12) != 0) | 399 | strncmp(buf, "HTTP/1.1 200 ", 13) != 0) |
400 | errx(1, "Proxy error: \"%s\"", buf); | 400 | errx(1, "Proxy error: \"%s\"", buf); |
401 | 401 | ||
402 | /* Headers continue until we hit an empty line */ | 402 | /* Headers continue until we hit an empty line */ |