Fix intermittent get-pac-test failures

https://github.com/libproxy/libproxy/pull/48
This commit is contained in:
David King 2017-01-01 17:56:33 +00:00
parent 2c6df979ee
commit 65f96bddfa
2 changed files with 61 additions and 2 deletions

View File

@ -0,0 +1,55 @@
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;

View File

@ -4,7 +4,7 @@
Name: libproxy
Version: 0.4.13
Release: 5%{?dist}
Release: 1%{?dist}
Summary: A library handling all the details of proxy configuration
Group: System Environment/Libraries
@ -15,6 +15,9 @@ Source0: https://github.com/libproxy/%{name}/archive/%{version}/%{name}-%
Source1: proxy.1
# http://code.google.com/p/libproxy/issues/detail?id=152
Patch0: 0001-Add-config-module-for-querying-PacRunner-d-mon.patch
# Avoid get-pac-test failure.
# https://github.com/libproxy/libproxy/pull/48
Patch1: libproxy-0.4.13-fix-get-pac-test.patch
BuildRequires: libmodman-devel >= 2.0.1
BuildRequires: cmake >= 2.6.0
@ -161,6 +164,7 @@ developing applications that use %{name}.
%prep
%autosetup -p1
%build
%{cmake} \
-DMODULE_INSTALL_DIR=%{_libdir}/%{name}/%{version}/modules \
@ -249,7 +253,7 @@ make test
%changelog
* Sun Jan 01 2017 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 0.4.13-5
* Sun Jan 01 2017 David King <amigadave@amigadave.com> - 0.4.13-1
- Update to 0.4.13
* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 0.4.12-5