Deleted Added
full compact
http.c (174751) http.c (174752)
1/*-
2 * Copyright (c) 2000-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) 2000-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/http.c 174751 2007-12-18 10:41:12Z des $");
30__FBSDID("$FreeBSD: head/lib/libfetch/http.c 174752 2007-12-18 11:03:07Z 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

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

714
715 val = 1;
716 setsockopt(conn->sd, IPPROTO_TCP, TCP_NOPUSH, &val, sizeof(val));
717
718 return (conn);
719}
720
721static struct url *
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

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

714
715 val = 1;
716 setsockopt(conn->sd, IPPROTO_TCP, TCP_NOPUSH, &val, sizeof(val));
717
718 return (conn);
719}
720
721static struct url *
722http_get_proxy(const char *flags)
722http_get_proxy(struct url * url, const char *flags)
723{
724 struct url *purl;
725 char *p;
726
727 if (flags != NULL && strchr(flags, 'd') != NULL)
728 return (NULL);
723{
724 struct url *purl;
725 char *p;
726
727 if (flags != NULL && strchr(flags, 'd') != NULL)
728 return (NULL);
729 if (fetch_no_proxy_match(url->host))
730 return (NULL);
729 if (((p = getenv("HTTP_PROXY")) || (p = getenv("http_proxy"))) &&
730 *p && (purl = fetchParseURL(p))) {
731 if (!*purl->scheme)
732 strcpy(purl->scheme, SCHEME_HTTP);
733 if (!purl->port)
734 purl->port = fetch_default_proxy_port(purl->scheme);
735 if (strcasecmp(purl->scheme, SCHEME_HTTP) == 0)
736 return (purl);

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

1163 */
1164
1165/*
1166 * Retrieve and stat a file by HTTP
1167 */
1168FILE *
1169fetchXGetHTTP(struct url *URL, struct url_stat *us, const char *flags)
1170{
731 if (((p = getenv("HTTP_PROXY")) || (p = getenv("http_proxy"))) &&
732 *p && (purl = fetchParseURL(p))) {
733 if (!*purl->scheme)
734 strcpy(purl->scheme, SCHEME_HTTP);
735 if (!purl->port)
736 purl->port = fetch_default_proxy_port(purl->scheme);
737 if (strcasecmp(purl->scheme, SCHEME_HTTP) == 0)
738 return (purl);

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

1165 */
1166
1167/*
1168 * Retrieve and stat a file by HTTP
1169 */
1170FILE *
1171fetchXGetHTTP(struct url *URL, struct url_stat *us, const char *flags)
1172{
1171 return (http_request(URL, "GET", us, http_get_proxy(flags), flags));
1173 return (http_request(URL, "GET", us, http_get_proxy(URL, flags), flags));
1172}
1173
1174/*
1175 * Retrieve a file by HTTP
1176 */
1177FILE *
1178fetchGetHTTP(struct url *URL, const char *flags)
1179{

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

1193/*
1194 * Get an HTTP document's metadata
1195 */
1196int
1197fetchStatHTTP(struct url *URL, struct url_stat *us, const char *flags)
1198{
1199 FILE *f;
1200
1174}
1175
1176/*
1177 * Retrieve a file by HTTP
1178 */
1179FILE *
1180fetchGetHTTP(struct url *URL, const char *flags)
1181{

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

1195/*
1196 * Get an HTTP document's metadata
1197 */
1198int
1199fetchStatHTTP(struct url *URL, struct url_stat *us, const char *flags)
1200{
1201 FILE *f;
1202
1201 f = http_request(URL, "HEAD", us, http_get_proxy(flags), flags);
1203 f = http_request(URL, "HEAD", us, http_get_proxy(URL, flags), flags);
1202 if (f == NULL)
1203 return (-1);
1204 fclose(f);
1205 return (0);
1206}
1207
1208/*
1209 * List a directory
1210 */
1211struct url_ent *
1212fetchListHTTP(struct url *url __unused, const char *flags __unused)
1213{
1214 warnx("fetchListHTTP(): not implemented");
1215 return (NULL);
1216}
1204 if (f == NULL)
1205 return (-1);
1206 fclose(f);
1207 return (0);
1208}
1209
1210/*
1211 * List a directory
1212 */
1213struct url_ent *
1214fetchListHTTP(struct url *url __unused, const char *flags __unused)
1215{
1216 warnx("fetchListHTTP(): not implemented");
1217 return (NULL);
1218}