Deleted Added
full compact
http.c (242289) http.c (242293)
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 242289 2012-10-29 04:16:52Z eadler $");
30__FBSDID("$FreeBSD: stable/9/lib/libfetch/http.c 242293 2012-10-29 04:18:34Z 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

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

90
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
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

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

90
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_USE_PROXY 305
98#define HTTP_TEMP_REDIRECT 307
99#define HTTP_PERM_REDIRECT 308
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 \
99#define HTTP_TEMP_REDIRECT 307
100#define HTTP_PERM_REDIRECT 308
101#define HTTP_NEED_AUTH 401
102#define HTTP_NEED_PROXY_AUTH 407
103#define HTTP_BAD_RANGE 416
104#define HTTP_PROTOCOL_ERROR 999
105
106#define HTTP_REDIRECT(xyz) ((xyz) == HTTP_MOVED_PERM \
107 || (xyz) == HTTP_MOVED_TEMP \
108 || (xyz) == HTTP_TEMP_REDIRECT \
109 || (xyz) == HTTP_USE_PROXY \
108 || (xyz) == HTTP_SEE_OTHER)
109
110#define HTTP_ERROR(xyz) ((xyz) > 400 && (xyz) < 599)
111
112
113/*****************************************************************************
114 * I/O functions for decoding chunked streams
115 */

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

1684 case HTTP_OK:
1685 case HTTP_PARTIAL:
1686 case HTTP_NOT_MODIFIED:
1687 /* fine */
1688 break;
1689 case HTTP_MOVED_PERM:
1690 case HTTP_MOVED_TEMP:
1691 case HTTP_SEE_OTHER:
110 || (xyz) == HTTP_SEE_OTHER)
111
112#define HTTP_ERROR(xyz) ((xyz) > 400 && (xyz) < 599)
113
114
115/*****************************************************************************
116 * I/O functions for decoding chunked streams
117 */

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

1686 case HTTP_OK:
1687 case HTTP_PARTIAL:
1688 case HTTP_NOT_MODIFIED:
1689 /* fine */
1690 break;
1691 case HTTP_MOVED_PERM:
1692 case HTTP_MOVED_TEMP:
1693 case HTTP_SEE_OTHER:
1694 case HTTP_USE_PROXY:
1692 /*
1693 * Not so fine, but we still have to read the
1694 * headers to get the new location.
1695 */
1696 break;
1697 case HTTP_NEED_AUTH:
1698 if (server_challenges.valid) {
1699 /*

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

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 &&
1695 /*
1696 * Not so fine, but we still have to read the
1697 * headers to get the new location.
1698 */
1699 break;
1700 case HTTP_NEED_AUTH:
1701 if (server_challenges.valid) {
1702 /*

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

1768 if (!HTTP_REDIRECT(conn->err))
1769 break;
1770 /*
1771 * if the A flag is set, we don't follow
1772 * temporary redirects.
1773 */
1774 if (noredirect &&
1775 conn->err != HTTP_MOVED_PERM &&
1773 conn->err != HTTP_PERM_REDIRECT) {
1776 conn->err != HTTP_PERM_REDIRECT &&
1777 conn->err != HTTP_USE_PROXY) {
1774 n = 1;
1775 break;
1776 }
1777 if (new)
1778 free(new);
1779 if (verbose)
1780 fetch_info("%d redirect to %s", conn->err, p);
1781 if (*p == '/')

--- 234 unchanged lines hidden ---
1778 n = 1;
1779 break;
1780 }
1781 if (new)
1782 free(new);
1783 if (verbose)
1784 fetch_info("%d redirect to %s", conn->err, p);
1785 if (*p == '/')

--- 234 unchanged lines hidden ---