Deleted Added
full compact
http.c (242032) http.c (242289)
1/*-
2 * Copyright (c) 2000-2011 Dag-Erling 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) 2000-2011 Dag-Erling 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: stable/9/lib/libfetch/http.c 242032 2012-10-25 03:11:18Z eadler $");
30__FBSDID("$FreeBSD: stable/9/lib/libfetch/http.c 242289 2012-10-29 04:16:52Z eadler $");
31
32/*
33 * The following copyright applies to the base64 code:
34 *
35 *-
36 * Copyright 1997 Massachusetts Institute of Technology
37 *
38 * Permission to use, copy, modify, and distribute this software and

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

91/* Symbolic names for reply codes we care about */
92#define HTTP_OK 200
93#define HTTP_PARTIAL 206
94#define HTTP_MOVED_PERM 301
95#define HTTP_MOVED_TEMP 302
96#define HTTP_SEE_OTHER 303
97#define HTTP_NOT_MODIFIED 304
98#define HTTP_TEMP_REDIRECT 307
31
32/*
33 * The following copyright applies to the base64 code:
34 *
35 *-
36 * Copyright 1997 Massachusetts Institute of Technology
37 *
38 * Permission to use, copy, modify, and distribute this software and

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

91/* Symbolic names for reply codes we care about */
92#define HTTP_OK 200
93#define HTTP_PARTIAL 206
94#define HTTP_MOVED_PERM 301
95#define HTTP_MOVED_TEMP 302
96#define HTTP_SEE_OTHER 303
97#define HTTP_NOT_MODIFIED 304
98#define HTTP_TEMP_REDIRECT 307
99#define HTTP_PERM_REDIRECT 308
99#define HTTP_NEED_AUTH 401
100#define HTTP_NEED_PROXY_AUTH 407
101#define HTTP_BAD_RANGE 416
102#define HTTP_PROTOCOL_ERROR 999
103
104#define HTTP_REDIRECT(xyz) ((xyz) == HTTP_MOVED_PERM \
105 || (xyz) == HTTP_MOVED_TEMP \
106 || (xyz) == HTTP_TEMP_REDIRECT \

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

1511 if (direct && purl) {
1512 fetchFreeURL(purl);
1513 purl = NULL;
1514 }
1515
1516 /* try the provided URL first */
1517 url = URL;
1518
100#define HTTP_NEED_AUTH 401
101#define HTTP_NEED_PROXY_AUTH 407
102#define HTTP_BAD_RANGE 416
103#define HTTP_PROTOCOL_ERROR 999
104
105#define HTTP_REDIRECT(xyz) ((xyz) == HTTP_MOVED_PERM \
106 || (xyz) == HTTP_MOVED_TEMP \
107 || (xyz) == HTTP_TEMP_REDIRECT \

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

1512 if (direct && purl) {
1513 fetchFreeURL(purl);
1514 purl = NULL;
1515 }
1516
1517 /* try the provided URL first */
1518 url = URL;
1519
1519 /* if the A flag is set, we only get one try */
1520 n = noredirect ? 1 : MAX_REDIRECT;
1520 n = MAX_REDIRECT;
1521 i = 0;
1522
1523 e = HTTP_PROTOCOL_ERROR;
1524 do {
1525 new = NULL;
1526 chunked = 0;
1527 offset = 0;
1528 clength = -1;

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

1759 http_parse_range(p, &offset, &length, &size);
1760 break;
1761 case hdr_last_modified:
1762 http_parse_mtime(p, &mtime);
1763 break;
1764 case hdr_location:
1765 if (!HTTP_REDIRECT(conn->err))
1766 break;
1521 i = 0;
1522
1523 e = HTTP_PROTOCOL_ERROR;
1524 do {
1525 new = NULL;
1526 chunked = 0;
1527 offset = 0;
1528 clength = -1;

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

1759 http_parse_range(p, &offset, &length, &size);
1760 break;
1761 case hdr_last_modified:
1762 http_parse_mtime(p, &mtime);
1763 break;
1764 case hdr_location:
1765 if (!HTTP_REDIRECT(conn->err))
1766 break;
1767 /*
1768 * if the A flag is set, we don't follow
1769 * temporary redirects.
1770 */
1771 if (noredirect &&
1772 conn->err != HTTP_MOVED_PERM &&
1773 conn->err != HTTP_PERM_REDIRECT) {
1774 n = 1;
1775 break;
1776 }
1767 if (new)
1768 free(new);
1769 if (verbose)
1770 fetch_info("%d redirect to %s", conn->err, p);
1771 if (*p == '/')
1772 /* absolute path */
1773 new = fetchMakeURL(url->scheme, url->host, url->port, p,
1774 url->user, url->pwd);

--- 231 unchanged lines hidden ---
1777 if (new)
1778 free(new);
1779 if (verbose)
1780 fetch_info("%d redirect to %s", conn->err, p);
1781 if (*p == '/')
1782 /* absolute path */
1783 new = fetchMakeURL(url->scheme, url->host, url->port, p,
1784 url->user, url->pwd);

--- 231 unchanged lines hidden ---