Deleted Added
full compact
common.c (174752) common.c (174761)
1/*-
2 * Copyright (c) 1998-2004 Dag-Erling Co�dan Sm�rgrav
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 13 unchanged lines hidden (view full) ---

22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1998-2004 Dag-Erling Co�dan Sm�rgrav
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 13 unchanged lines hidden (view full) ---

22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: head/lib/libfetch/common.c 174752 2007-12-18 11:03:07Z des $");
30__FBSDID("$FreeBSD: head/lib/libfetch/common.c 174761 2007-12-19 00:26:36Z des $");
31
32#include <sys/param.h>
33#include <sys/socket.h>
34#include <sys/time.h>
35#include <sys/uio.h>
36
37#include <netinet/in.h>
38

--- 719 unchanged lines hidden (view full) ---

758 /* asterisk matches any hostname */
759 if (strcmp(no_proxy, "*") == 0)
760 return (1);
761
762 h_len = strlen(host);
763 p = no_proxy;
764 do {
765 /* position p at the beginning of a domain suffix */
31
32#include <sys/param.h>
33#include <sys/socket.h>
34#include <sys/time.h>
35#include <sys/uio.h>
36
37#include <netinet/in.h>
38

--- 719 unchanged lines hidden (view full) ---

758 /* asterisk matches any hostname */
759 if (strcmp(no_proxy, "*") == 0)
760 return (1);
761
762 h_len = strlen(host);
763 p = no_proxy;
764 do {
765 /* position p at the beginning of a domain suffix */
766 while (*p == ',' || isspace((int)*p))
766 while (*p == ',' || isspace((unsigned char)*p))
767 p++;
768
769 /* position q at the first separator character */
770 for (q = p; *q; ++q)
767 p++;
768
769 /* position q at the first separator character */
770 for (q = p; *q; ++q)
771 if (*q == ',' || isspace((int)*q))
771 if (*q == ',' || isspace((unsigned char)*q))
772 break;
773
774 d_len = q - p;
775 if (d_len > 0 && h_len > d_len &&
776 strncasecmp(host + h_len - d_len,
777 p, d_len) == 0) {
778 /* domain name matches */
779 return (1);
780 }
781
782 p = q + 1;
783 } while (*q);
784
785 return (0);
786}
772 break;
773
774 d_len = q - p;
775 if (d_len > 0 && h_len > d_len &&
776 strncasecmp(host + h_len - d_len,
777 p, d_len) == 0) {
778 /* domain name matches */
779 return (1);
780 }
781
782 p = q + 1;
783 } while (*q);
784
785 return (0);
786}