Deleted Added
full compact
fetch.c (174751) fetch.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/fetch.c 174751 2007-12-18 10:41:12Z des $");
30__FBSDID("$FreeBSD: head/lib/libfetch/fetch.c 174761 2007-12-19 00:26:36Z des $");
31
32#include <sys/param.h>
33#include <sys/errno.h>
34
35#include <ctype.h>
36#include <stdio.h>
37#include <stdlib.h>
38#include <string.h>

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

364#endif
365 for (i = 0; *p && (*p != '/') && (*p != ':'); p++)
366 if (i < MAXHOSTNAMELEN)
367 u->host[i++] = *p;
368
369 /* port */
370 if (*p == ':') {
371 for (q = ++p; *q && (*q != '/'); q++)
31
32#include <sys/param.h>
33#include <sys/errno.h>
34
35#include <ctype.h>
36#include <stdio.h>
37#include <stdlib.h>
38#include <string.h>

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

364#endif
365 for (i = 0; *p && (*p != '/') && (*p != ':'); p++)
366 if (i < MAXHOSTNAMELEN)
367 u->host[i++] = *p;
368
369 /* port */
370 if (*p == ':') {
371 for (q = ++p; *q && (*q != '/'); q++)
372 if (isdigit((int)*q))
372 if (isdigit((unsigned char)*q))
373 u->port = u->port * 10 + (*q - '0');
374 else {
375 /* invalid port */
376 url_seterr(URL_BAD_PORT);
377 goto ouch;
378 }
379 p = q;
380 }

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

390
391 /* percent-escape whitespace. */
392 if ((doc = malloc(strlen(p) * 3 + 1)) == NULL) {
393 fetch_syserr();
394 goto ouch;
395 }
396 u->doc = doc;
397 while (*p != '\0') {
373 u->port = u->port * 10 + (*q - '0');
374 else {
375 /* invalid port */
376 url_seterr(URL_BAD_PORT);
377 goto ouch;
378 }
379 p = q;
380 }

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

390
391 /* percent-escape whitespace. */
392 if ((doc = malloc(strlen(p) * 3 + 1)) == NULL) {
393 fetch_syserr();
394 goto ouch;
395 }
396 u->doc = doc;
397 while (*p != '\0') {
398 if (!isspace((int)*p)) {
398 if (!isspace((unsigned char)*p)) {
399 *doc++ = *p++;
400 } else {
401 *doc++ = '%';
402 *doc++ = hexnums[((unsigned int)*p) >> 4];
403 *doc++ = hexnums[((unsigned int)*p) & 0xf];
404 p++;
405 }
406 }

--- 32 unchanged lines hidden ---
399 *doc++ = *p++;
400 } else {
401 *doc++ = '%';
402 *doc++ = hexnums[((unsigned int)*p) >> 4];
403 *doc++ = hexnums[((unsigned int)*p) & 0xf];
404 p++;
405 }
406 }

--- 32 unchanged lines hidden ---