http.c (90267) | http.c (93399) |
---|---|
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 90267 2002-02-05 22:13:51Z des $"); | 30__FBSDID("$FreeBSD: head/lib/libfetch/http.c 93399 2002-03-29 22:43:43Z markm $"); |
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 --- 36 unchanged lines hidden (view full) --- 75#include <string.h> 76#include <time.h> 77#include <unistd.h> 78 79#include "fetch.h" 80#include "common.h" 81#include "httperr.h" 82 | 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 --- 36 unchanged lines hidden (view full) --- 75#include <string.h> 76#include <time.h> 77#include <unistd.h> 78 79#include "fetch.h" 80#include "common.h" 81#include "httperr.h" 82 |
83extern char *__progname; /* XXX not portable */ 84 | |
85/* Maximum number of redirects to follow */ 86#define MAX_REDIRECT 5 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 --- 742 unchanged lines hidden (view full) --- 835 goto ouch; 836 } 837 } 838 839 /* other headers */ 840 if ((p = getenv("HTTP_USER_AGENT")) != NULL && *p != '\0') 841 _http_cmd(fd, "User-Agent: %s", p); 842 else | 83/* Maximum number of redirects to follow */ 84#define MAX_REDIRECT 5 85 86/* Symbolic names for reply codes we care about */ 87#define HTTP_OK 200 88#define HTTP_PARTIAL 206 89#define HTTP_MOVED_PERM 301 90#define HTTP_MOVED_TEMP 302 --- 742 unchanged lines hidden (view full) --- 833 goto ouch; 834 } 835 } 836 837 /* other headers */ 838 if ((p = getenv("HTTP_USER_AGENT")) != NULL && *p != '\0') 839 _http_cmd(fd, "User-Agent: %s", p); 840 else |
843 _http_cmd(fd, "User-Agent: %s " _LIBFETCH_VER, __progname); | 841 _http_cmd(fd, "User-Agent: %s " _LIBFETCH_VER, _getprogname()); |
844 if (url->offset) 845 _http_cmd(fd, "Range: bytes=%lld-", (long long)url->offset); 846 _http_cmd(fd, "Connection: close"); 847 _http_cmd(fd, ""); 848 849 /* get reply */ 850 switch ((code = _http_get_reply(fd))) { 851 case HTTP_OK: --- 256 unchanged lines hidden --- | 842 if (url->offset) 843 _http_cmd(fd, "Range: bytes=%lld-", (long long)url->offset); 844 _http_cmd(fd, "Connection: close"); 845 _http_cmd(fd, ""); 846 847 /* get reply */ 848 switch ((code = _http_get_reply(fd))) { 849 case HTTP_OK: --- 256 unchanged lines hidden --- |