libproxy/libproxy-0.4.13-fix-get-pac-test.patch

56 lines
1.7 KiB
Diff

diff -urN libproxy-0.4.13.old/libproxy/test/get-pac-test.cpp libproxy-0.4.13/libproxy/test/get-pac-test.cpp
--- libproxy-0.4.13.old/libproxy/test/get-pac-test.cpp 2016-04-28 18:04:41.000000000 +0100
+++ libproxy-0.4.13/libproxy/test/get-pac-test.cpp 2017-01-01 16:44:28.736433853 +0000
@@ -164,7 +164,6 @@
ret = send(csock, (void*)basic, strlen(basic), 0);
assert(ret == strlen(basic));
shutdown(csock, SHUT_RDWR);
- close(ret);
}
void sendTruncated(int csock)
@@ -179,29 +178,27 @@
ret = send(csock, (void*)basic, strlen(basic), 0);
assert(ret == strlen(basic));
shutdown(csock, SHUT_RDWR);
- close(ret);
}
void sendOverflow(int csock)
{
int ret;
- int size = 500000;
+ int size = 50000000; // Must be larger than the kernel TCP receive buffer
char *buf = new char[size];
memset(buf, 1, size);
const char *basic =
"HTTP/1.1 200 OK\n" \
"Content-Type: text/plain\n" \
- "Content-Length: 500000\n" \
+ "Content-Length: 50000000\n" \
"\n";
- ret = send(csock, (void*)basic, strlen(basic), 0);
+ ret = send(csock, (void*)basic, strlen(basic), MSG_NOSIGNAL);
assert(ret == strlen(basic));
- ret = send(csock, (void*)buf, size, 0);
- if (!(errno == EBADF))
- abort(); // Test failed... the socket did not close on us
+ ret = send(csock, (void*)buf, size, MSG_NOSIGNAL);
+ if (ret == size)
+ abort(); // Test failed... the socket should not accept the whole buffer
delete[] buf;
shutdown(csock, SHUT_RDWR);
- close(ret);
}
void sendChunked(int csock)
@@ -221,7 +218,6 @@
ret = send(csock, (void*)chunked, strlen(chunked), 0);
assert(ret == strlen(chunked));
shutdown(csock, SHUT_RDWR);
- close(ret);
}
in_port_t m_port;