亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? fetch.c

?? EFI(Extensible Firmware Interface)是下一代BIOS
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*	$NetBSD: fetch.c,v 1.16.2.1 1997/11/18 01:00:22 mellon Exp $	*/

/*-
 * Copyright (c) 1997 The NetBSD Foundation, Inc.
 * All rights reserved.
 *
 * This code is derived from software contributed to The NetBSD Foundation
 * by Jason Thorpe and Luke Mewburn.
 *
 *
 * Portions copyright (c) 1999, 2000
 * Intel Corporation.
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 * 
 *    This product includes software developed by the University of
 *    California, Berkeley, Intel Corporation, and its contributors.
 * 
 * 4. Neither the name of University, Intel Corporation, or their respective
 *    contributors may be used to endorse or promote products derived from
 *    this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS, INTEL CORPORATION AND
 * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS,
 * INTEL CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 */

#include <sys/cdefs.h>
#ifndef lint
__RCSID("$Id: fetch.c,v 1.5 1997/12/16 08:58:15 ache Exp $");
__RCSID_SOURCE("$NetBSD: fetch.c,v 1.16.2.1 1997/11/18 01:00:22 mellon Exp $");
#endif /* not lint */

/*
 * FTP User Program -- Command line file retrieval
 */

#include <sys/types.h>
#include <sys/param.h>
#include <sys/socket.h>

#include <netinet/in.h>

#include <arpa/ftp.h>
#include <arpa/inet.h>

#include <ctype.h>
#include <err.h>
#include <netdb.h>
#include <fcntl.h>
#if !EFI32 && !EFI64	
#include <signal.h>		/* EFI Port: not used */
#endif /* EFI32 || EFI64 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include "ftp_var.h"

static int	url_get __P((const char *, const char *));
void    	aborthttp __P((int));


#define	FTP_URL		"ftp://"	/* ftp URL prefix */
#define	HTTP_URL	"http://"	/* http URL prefix */
#define FTP_PROXY	"ftp_proxy"	/* env var with ftp proxy location */
#define HTTP_PROXY	"http_proxy"	/* env var with http proxy location */


#define EMPTYSTRING(x)	((x) == NULL || (*(x) == '\0'))

jmp_buf	httpabort;

/*
 * Retrieve URL, via the proxy in $proxyvar if necessary.
 * Modifies the string argument given.
 * Returns -1 on failure, 0 on success
 */
static int
url_get(origline, proxyenv)
	const char *origline;
	const char *proxyenv;
{
	struct sockaddr_in sin;
	int i, out, isftpurl;
	u_int16_t port;
	volatile int s;
	size_t len;
#if EFI32 || EFI64
	char c, *cp, *ep, *portnum, *path;
	static char buf[4096];
#else
	char c, *cp, *ep, *portnum, *path, buf[4096];
#endif
	const char *savefile;
	char *line, *proxy, *host;
	volatile sig_t oldintr;
	off_t hashbytes;

	s = -1;
	proxy = NULL;
	isftpurl = 0;

#ifdef __GNUC__			/* XXX: to shut up gcc warnings */
	(void)&savefile;
	(void)&proxy;
#endif

	line = strdup(origline);
	if (line == NULL)
		errx(1, "Can't allocate memory to parse URL");
	if (strncasecmp(line, HTTP_URL, sizeof(HTTP_URL) - 1) == 0)
		host = line + sizeof(HTTP_URL) - 1;
	else if (strncasecmp(line, FTP_URL, sizeof(FTP_URL) - 1) == 0) {
		host = line + sizeof(FTP_URL) - 1;
		isftpurl = 1;
	} else
		errx(1, "url_get: Invalid URL '%s'", line);

	path = strchr(host, '/');		/* find path */
	if (EMPTYSTRING(path)) {
		if (isftpurl)
			goto noftpautologin;
		warnx("Invalid URL (no `/' after host): %s", origline);
		goto cleanup_url_get;
	}
	*path++ = '\0';
	if (EMPTYSTRING(path)) {
		if (isftpurl)
			goto noftpautologin;
		warnx("Invalid URL (no file after host): %s", origline);
		goto cleanup_url_get;
	}

	savefile = strrchr(path, '/');			/* find savefile */
	if (savefile != NULL)
		savefile++;
	else
		savefile = path;
	if (EMPTYSTRING(savefile)) {
		if (isftpurl)
			goto noftpautologin;
		warnx("Invalid URL (no file after directory): %s", origline);
		goto cleanup_url_get;
	}

	if (proxyenv != NULL) {				/* use proxy */
		proxy = strdup(proxyenv);
		if (proxy == NULL)
			errx(1, "Can't allocate memory for proxy URL.");
		if (strncasecmp(proxy, HTTP_URL, sizeof(HTTP_URL) - 1) == 0)
			host = proxy + sizeof(HTTP_URL) - 1;
		else if (strncasecmp(proxy, FTP_URL, sizeof(FTP_URL) - 1) == 0)
			host = proxy + sizeof(FTP_URL) - 1;
		else {
			warnx("Malformed proxy URL: %s", proxyenv);
			goto cleanup_url_get;
		}
		if (EMPTYSTRING(host)) {
			warnx("Malformed proxy URL: %s", proxyenv);
			goto cleanup_url_get;
		}
		*--path = '/';			/* add / back to real path */
		path = strchr(host, '/');	/* remove trailing / on host */
		if (! EMPTYSTRING(path))
			*path++ = '\0';
		path = line;
	}

	portnum = strchr(host, ':');			/* find portnum */
	if (portnum != NULL)
		*portnum++ = '\0';

	if (debug)
		printf("host %s, port %s, path %s, save as %s.\n",
		    host, portnum, path, savefile);

	memset(&sin, 0, sizeof(sin));
	sin.sin_family = AF_INET;

	if (isdigit((unsigned char)host[0])) {
		if (inet_aton(host, &sin.sin_addr) == 0) {
			warnx("Invalid IP address: %s", host);
			goto cleanup_url_get;
		}
	} else {
		struct hostent *hp;

		hp = gethostbyname(host);
		if (hp == NULL) {
			warnx("%s: %s", host, hstrerror(h_errno));
			goto cleanup_url_get;
		}
		if (hp->h_addrtype != AF_INET) {
			warnx("%s: not an Internet address?", host);
			goto cleanup_url_get;
		}
		memcpy(&sin.sin_addr, hp->h_addr, hp->h_length);
	}

	if (! EMPTYSTRING(portnum)) {
		char *ep;
		long nport;

		nport = strtol(portnum, &ep, 10);
		if (nport < 1 || nport > 0xffff || *ep != '\0') {
			warnx("Invalid port: %s", portnum);
			goto cleanup_url_get;
		}
		port = htons(nport);
	} else
		port = httpport;
	sin.sin_port = port;

	s = socket(AF_INET, SOCK_STREAM, 0);
	if (s == -1) {
		warn("Can't create socket");
		goto cleanup_url_get;
	}

	if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) == -1) {
		warn("Can't connect to %s", host);
		goto cleanup_url_get;
	}

	/*
	 * Construct and send the request.  We're expecting a return
	 * status of "200". Proxy requests don't want leading /.
	 */
	if (!proxy)
		printf("Requesting %s\n", origline);
	else
		printf("Requesting %s (via %s)\n", origline, proxyenv);
	len = snprintf(buf, sizeof(buf), "GET %s%s HTTP/1.0\r\n\r\n",
	    proxy ? "" : "/", path);
	if (write(s, buf, len) < (int)len) {	/* cast added for EFI port */
		warn("Writing HTTP request");
		goto cleanup_url_get;
	}
	memset(buf, 0, sizeof(buf));
	for (cp = buf; cp < buf + sizeof(buf); ) {
		if (read(s, cp, 1) != 1)
			goto improper;
		if (*cp == '\r')
			continue;
		if (*cp == '\n')
			break;
		cp++;
	}
	buf[sizeof(buf) - 1] = '\0';		/* sanity */
	cp = strchr(buf, ' ');
	if (cp == NULL)
		goto improper;
	else
		cp++;
	if (strncmp(cp, "200", 3)) {
		warnx("Error retrieving file: %s", cp);
		goto cleanup_url_get;
	}

	/*
	 * Read the rest of the header.
	 */
	memset(buf, 0, sizeof(buf));
	c = '\0';
	for (cp = buf; cp < buf + sizeof(buf); ) {
		if (read(s, cp, 1) != 1)
			goto improper;
		if (*cp == '\r')
			continue;
		if (*cp == '\n' && c == '\n')
			break;
		c = *cp;
		cp++;
	}
	buf[sizeof(buf) - 1] = '\0';		/* sanity */

	/*
	 * Look for the "Content-length: " header.
	 */
#define CONTENTLEN "Content-Length: "
	for (cp = buf; *cp != '\0'; cp++) {
		if (tolower((unsigned char)*cp) == 'c' &&
		    strncasecmp(cp, CONTENTLEN, sizeof(CONTENTLEN) - 1) == 0)
			break;
	}
	if (*cp != '\0') {
		cp += sizeof(CONTENTLEN) - 1;
		ep = strchr(cp, '\n');
		if (ep == NULL)
			goto improper;
		else
			*ep = '\0';
		filesize = strtol(cp, &ep, 10);
		if (filesize < 1 || *ep != '\0')
			goto improper;
	} else
		filesize = -1;

	/* Open the output file. */
	out = open(savefile, O_CREAT | O_WRONLY | O_TRUNC, 0666);
	if (out < 0) {
		warn("Can't open %s", savefile);
		goto cleanup_url_get;
	}

	/* Trap signals */

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品午夜久久福利影院| 日本不卡视频一二三区| 亚洲第一综合色| 伊人夜夜躁av伊人久久| 国产成人精品www牛牛影视| 成人激情免费网站| 日韩免费成人网| 久久精品一区四区| 一区二区三区国产豹纹内裤在线| 免费在线成人网| 国内精品久久久久影院一蜜桃| 777久久久精品| 国产情人综合久久777777| 国产亚洲欧美日韩在线一区| 综合久久综合久久| 国产高清精品网站| 亚洲精品在线电影| 中文字幕一区二区三| 最新久久zyz资源站| 欧美精品精品一区| 欧美国产亚洲另类动漫| 免费人成黄页网站在线一区二区| 国产麻豆精品95视频| 日韩视频免费直播| 国产精品一区二区在线观看网站| 成人av在线网| 国产精品色婷婷久久58| 国产真实乱偷精品视频免| 成人va在线观看| 亚洲人xxxx| 欧美美女网站色| 久久精品欧美一区二区三区麻豆| 美女网站在线免费欧美精品| 成人免费视频app| 国产精品不卡在线观看| 精品久久久久久久久久久久久久久久久 | 国产一区二区在线观看视频| 日韩一区二区免费在线观看| 91亚洲午夜精品久久久久久| 国产精品久久久一本精品| 国产成人在线网站| 亚洲欧美日韩一区| 色婷婷综合久久久久中文 | 国产精品伦理在线| 国产不卡视频在线播放| 亚洲日穴在线视频| 在线观看免费成人| 亚洲一区二区三区美女| 日韩欧美国产三级电影视频| 国精品**一区二区三区在线蜜桃| 欧美男女性生活在线直播观看| 亚洲成人精品影院| 久久久久久久久久久久久夜| 韩国午夜理伦三级不卡影院| 国产精品三级在线观看| 久久久久亚洲综合| 日本高清无吗v一区| 成人激情文学综合网| 久久超碰97人人做人人爱| 国产视频一区在线观看| 7777精品伊人久久久大香线蕉超级流畅 | 亚洲人快播电影网| 欧美丰满高潮xxxx喷水动漫| 精品一区二区精品| 免费美女久久99| 亚洲摸摸操操av| 国产女同性恋一区二区| 久久综合视频网| 国产性做久久久久久| 欧美α欧美αv大片| 91美女在线看| 欧美喷水一区二区| 97se亚洲国产综合在线| 国产不卡在线播放| 国产风韵犹存在线视精品| 亚洲一区在线电影| 中文字幕一区日韩精品欧美| 久久亚洲一区二区三区四区| 91麻豆精品国产自产在线| 欧美日韩日日骚| 久久久久久久久久久久电影| 国产亚洲综合av| 日一区二区三区| 国产精品原创巨作av| 国产91在线观看丝袜| 国产毛片精品一区| 国内精品国产三级国产a久久| 日韩国产欧美在线视频| 秋霞电影网一区二区| 久久国内精品视频| 成人爱爱电影网址| 91精品麻豆日日躁夜夜躁| 国产日韩欧美一区二区三区乱码 | 亚洲成人精品一区二区| 午夜精品在线看| 国产精品一二一区| 日韩视频免费观看高清完整版在线观看 | 亚洲色图20p| 国产精品一区二区男女羞羞无遮挡| 精品久久久久久久久久久久包黑料 | 日韩欧美专区在线| 国产亚洲精品中文字幕| 国产在线日韩欧美| 国产suv精品一区二区三区| 日韩一区二区不卡| 亚洲男人天堂一区| 成人黄色小视频在线观看| 成人av在线资源网| 国产精品久久久久一区 | 免费在线看一区| 久久精品国产精品亚洲综合| 国产精品入口麻豆原神| 免费xxxx性欧美18vr| 欧美三级午夜理伦三级中视频| 亚洲自拍偷拍欧美| 久久国产麻豆精品| 欧美精品久久久久久久多人混战| 亚洲欧美电影一区二区| 国产69精品久久久久777| av亚洲精华国产精华精华| 日韩午夜在线观看视频| 日日噜噜夜夜狠狠视频欧美人| 日韩三级免费观看| 国产精品综合av一区二区国产馆| 欧美一区二区三区视频免费播放| 午夜精品久久久久久久99水蜜桃| 欧美午夜精品久久久| 成人av午夜电影| 亚洲国产精品v| 91精品在线一区二区| 国内外精品视频| 一区二区三区在线视频观看| 欧美一区二区三级| 99久久国产综合色|国产精品| 1000精品久久久久久久久| 欧美一区二区观看视频| 国产成人av在线影院| 一区二区在线观看视频| 欧美精品第1页| 国产成人精品aa毛片| 亚洲精品国产a| 精品福利一区二区三区免费视频| 国产精品一卡二| 一区二区三区四区在线播放 | 日本视频中文字幕一区二区三区| 精品国产百合女同互慰| www.亚洲免费av| 精东粉嫩av免费一区二区三区| 亚洲一区二区三区中文字幕在线| 国产亚洲短视频| 日韩欧美激情四射| 欧美一二三在线| 91麻豆.com| 99re亚洲国产精品| 成人18视频在线播放| 九一九一国产精品| 一区二区三区在线影院| 日韩免费看的电影| 欧美日韩精品福利| 日韩欧美国产电影| 日本高清无吗v一区| 精品一区二区三区的国产在线播放| 国产高清久久久久| 成人综合在线观看| 色综合久久99| 99久久er热在这里只有精品15| 久草在线在线精品观看| 蜜臀91精品一区二区三区| 久久精品国产精品亚洲红杏| 国产成人精品免费一区二区| 91久久一区二区| 欧美一区二区精品在线| 日韩免费看的电影| 337p日本欧洲亚洲大胆精品 | 国产伦精品一区二区三区免费迷| 午夜精品久久久久久不卡8050| 激情五月婷婷综合| 久久精品国产亚洲aⅴ| 日韩avvvv在线播放| 国产一区二区主播在线| 91麻豆国产精品久久| 欧美羞羞免费网站| 日韩免费观看高清完整版在线观看| 欧美日韩国产a| 国产视频一区在线观看| 视频在线观看91| 成人午夜精品在线| 91精品在线免费观看| 自拍偷自拍亚洲精品播放| 国产电影一区在线| 日韩一区二区三区精品视频| 精品va天堂亚洲国产| 亚洲男人的天堂一区二区| 激情国产一区二区| 欧美日韩国产免费一区二区| 一区二区中文视频| 麻豆成人久久精品二区三区红| 成人av网站在线| 中文字幕 久热精品 视频在线| 亚洲成a人在线观看|