Deleted Added
full compact
http.c (85093) http.c (87317)
1/*-
2 * Copyright (c) 2000 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) 2000 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/http.c 85093 2001-10-18 08:29:26Z des $");
30__FBSDID("$FreeBSD: head/lib/libfetch/http.c 87317 2001-12-04 01:12:51Z des $");
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

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

87
88/* Symbolic names for reply codes we care about */
89#define HTTP_OK 200
90#define HTTP_PARTIAL 206
91#define HTTP_MOVED_PERM 301
92#define HTTP_MOVED_TEMP 302
93#define HTTP_SEE_OTHER 303
94#define HTTP_NEED_AUTH 401
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

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

87
88/* Symbolic names for reply codes we care about */
89#define HTTP_OK 200
90#define HTTP_PARTIAL 206
91#define HTTP_MOVED_PERM 301
92#define HTTP_MOVED_TEMP 302
93#define HTTP_SEE_OTHER 303
94#define HTTP_NEED_AUTH 401
95#define HTTP_NEED_PROXY_AUTH 403
95#define HTTP_NEED_PROXY_AUTH 407
96#define HTTP_PROTOCOL_ERROR 999
97
98#define HTTP_REDIRECT(xyz) ((xyz) == HTTP_MOVED_PERM \
99 || (xyz) == HTTP_MOVED_TEMP \
100 || (xyz) == HTTP_SEE_OTHER)
101
102
103

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

723 length = -1;
724 size = -1;
725 mtime = 0;
726
727 /* check port */
728 if (!url->port)
729 url->port = _fetch_default_port(url->scheme);
730
96#define HTTP_PROTOCOL_ERROR 999
97
98#define HTTP_REDIRECT(xyz) ((xyz) == HTTP_MOVED_PERM \
99 || (xyz) == HTTP_MOVED_TEMP \
100 || (xyz) == HTTP_SEE_OTHER)
101
102
103

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

723 length = -1;
724 size = -1;
725 mtime = 0;
726
727 /* check port */
728 if (!url->port)
729 url->port = _fetch_default_port(url->scheme);
730
731 /* were we redirected to an FTP URL? */
732 if (purl == NULL && strcmp(url->scheme, SCHEME_FTP) == 0) {
733 if (strcmp(op, "GET") == 0)
734 return _ftp_request(url, "RETR", us, purl, flags);
735 else if (strcmp(op, "HEAD") == 0)
736 return _ftp_request(url, "STAT", us, purl, flags);
737 }
738
731 /* connect to server or proxy */
732 if ((fd = _http_connect(url, purl, flags)) == -1)
733 goto ouch;
734
735 host = url->host;
736#ifdef INET6
737 if (strchr(url->host, ':')) {
738 snprintf(hbuf, sizeof(hbuf), "[%s]", url->host);

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

794 /* get reply */
795 switch ((code = _http_get_reply(fd))) {
796 case HTTP_OK:
797 case HTTP_PARTIAL:
798 /* fine */
799 break;
800 case HTTP_MOVED_PERM:
801 case HTTP_MOVED_TEMP:
739 /* connect to server or proxy */
740 if ((fd = _http_connect(url, purl, flags)) == -1)
741 goto ouch;
742
743 host = url->host;
744#ifdef INET6
745 if (strchr(url->host, ':')) {
746 snprintf(hbuf, sizeof(hbuf), "[%s]", url->host);

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

802 /* get reply */
803 switch ((code = _http_get_reply(fd))) {
804 case HTTP_OK:
805 case HTTP_PARTIAL:
806 /* fine */
807 break;
808 case HTTP_MOVED_PERM:
809 case HTTP_MOVED_TEMP:
810 case HTTP_SEE_OTHER:
802 /*
803 * Not so fine, but we still have to read the headers to
804 * get the new location.
805 */
806 break;
807 case HTTP_NEED_AUTH:
808 if (need_auth) {
809 /*

--- 234 unchanged lines hidden ---
811 /*
812 * Not so fine, but we still have to read the headers to
813 * get the new location.
814 */
815 break;
816 case HTTP_NEED_AUTH:
817 if (need_auth) {
818 /*

--- 234 unchanged lines hidden ---