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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? 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 */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
蜜桃在线一区二区三区| 欧美性猛交xxxx黑人交| 久久99国产精品免费网站| 豆国产96在线|亚洲| 国产最新精品免费| 国产高清久久久| 国产精品亚洲视频| 国产凹凸在线观看一区二区| 国产麻豆日韩欧美久久| 国产成人在线视频免费播放| 国产精品99久久久久久似苏梦涵| 国产福利不卡视频| av一区二区三区四区| 91色乱码一区二区三区| 欧洲在线/亚洲| 欧美日韩国产高清一区| 日韩欧美不卡在线观看视频| 337p粉嫩大胆噜噜噜噜噜91av | 色婷婷香蕉在线一区二区| 色综合久久综合| 欧美日韩在线播放一区| 欧美一级精品在线| 国产网站一区二区| 国产精品美女久久久久aⅴ| 亚洲欧洲www| 一区二区在线看| 欧美aa在线视频| 国产成人精品三级麻豆| 色中色一区二区| 91精品国产91久久综合桃花| 一区二区三区在线视频免费| 懂色av噜噜一区二区三区av| 国产精品久久久久一区二区三区| 日本不卡一区二区三区高清视频| 免费观看在线综合色| 国内成人精品2018免费看| 成人综合婷婷国产精品久久蜜臀 | 三级欧美韩日大片在线看| 麻豆久久久久久久| 成人免费的视频| 777午夜精品免费视频| 久久精品亚洲精品国产欧美| 亚洲精品国产无天堂网2021| 九色|91porny| 91啪在线观看| 精品国产一区二区国模嫣然| 一区精品在线播放| 毛片av一区二区| 99精品国产99久久久久久白柏 | 日韩久久一区二区| 日韩高清国产一区在线| 成人va在线观看| 日韩欧美国产一区二区在线播放| 国产精品麻豆99久久久久久| 丝袜美腿亚洲一区二区图片| 国产福利视频一区二区三区| 欧美曰成人黄网| 中文字幕乱码亚洲精品一区| 亚洲成人精品影院| 成人动漫中文字幕| 日韩欧美一区二区视频| 亚洲精品乱码久久久久久| 国产精品系列在线播放| 欧美三级韩国三级日本一级| 国产精品国产三级国产普通话蜜臀| 天堂影院一区二区| 99久久伊人久久99| 久久免费电影网| 日本系列欧美系列| 色婷婷av一区二区三区gif| 久久综合狠狠综合久久综合88| 一区二区三区 在线观看视频| 国产精品99久久不卡二区| 日韩一级成人av| 一区二区激情小说| av激情亚洲男人天堂| 久久久不卡网国产精品一区| 日本中文在线一区| 精品视频在线免费| 亚洲精品伦理在线| 99国产精品久| 国产欧美一区二区精品仙草咪| 另类小说欧美激情| 制服丝袜亚洲网站| 亚洲va在线va天堂| 欧美午夜不卡在线观看免费| 亚洲欧美自拍偷拍| 成人动漫一区二区| 中文字幕国产一区二区| 国产白丝精品91爽爽久久| 久久久久久麻豆| 国产精品911| 久久久亚洲高清| 国产一区 二区 三区一级| 日韩精品一区国产麻豆| 麻豆久久久久久久| 欧美成va人片在线观看| 蜜臀av一区二区三区| 欧美一区二区免费视频| 天天操天天色综合| 91.xcao| 人人超碰91尤物精品国产| 56国语精品自产拍在线观看| 五月激情综合婷婷| 91精品在线一区二区| 视频一区二区中文字幕| 777欧美精品| 极品少妇一区二区三区精品视频| 欧美成人精品1314www| 精品一区二区精品| 久久久99久久精品欧美| 粉嫩蜜臀av国产精品网站| 国产欧美1区2区3区| 成人综合婷婷国产精品久久免费| 成人欧美一区二区三区视频网页| 91农村精品一区二区在线| 一区二区三区国产精华| 777午夜精品视频在线播放| 久久精品国产一区二区三区免费看| 久久综合九色综合欧美98| 国产不卡视频一区| 亚洲精品国产一区二区精华液| 欧美午夜在线观看| 日本视频免费一区| 久久精品男人天堂av| 成人av资源网站| 亚洲一区av在线| 日韩一区二区三区观看| 激情五月婷婷综合网| 国产精品免费久久| 欧美午夜不卡视频| 狠狠色综合色综合网络| 国产精品国产a| 欧美日韩免费不卡视频一区二区三区| 日本sm残虐另类| 国产精品久久久久久久久快鸭| 在线观看国产日韩| 精品一区二区三区视频在线观看| 国产精品久久影院| 欧美日韩你懂得| 国产精品一区二区久久不卡 | 亚洲一区二区四区蜜桃| 欧美精品v日韩精品v韩国精品v| 久久av资源网| 亚洲三级理论片| 欧美一区二区三区四区高清| 国产99精品视频| 性久久久久久久久| 国产精品视频免费看| 在线播放91灌醉迷j高跟美女| 国产精品中文有码| 午夜精品成人在线视频| 国产午夜精品福利| 欧美日韩一区二区电影| 国产一区二区免费视频| 亚洲高清免费观看| 国产精品全国免费观看高清| 欧美一卡2卡3卡4卡| 91在线观看视频| 久久成人免费日本黄色| 伊人色综合久久天天人手人婷| 亚洲精品在线一区二区| 在线免费一区三区| 国产福利精品一区二区| 日韩电影在线一区二区三区| 亚洲色图色小说| 久久人人爽人人爽| 欧美日韩国产乱码电影| 亚洲精品成a人| 91蜜桃在线观看| 精品中文字幕一区二区| 一区二区三区美女视频| 欧美高清一级片在线观看| 51精品国自产在线| 91久久精品一区二区三| 国产寡妇亲子伦一区二区| 男女性色大片免费观看一区二区| 亚洲激情欧美激情| 国产精品久久久久9999吃药| 欧美精品一区二区三区蜜臀| 欧美精品 日韩| 日本道色综合久久| 99久久国产综合色|国产精品| 国产成都精品91一区二区三| 裸体一区二区三区| 日韩电影一二三区| 亚洲成人av电影在线| 一区二区三区成人在线视频| 亚洲素人一区二区| 中文字幕一区二区三区四区| 国产欧美日韩亚州综合| 精品国产乱码久久久久久免费| 欧美精品免费视频| 欧美人与禽zozo性伦| 欧美性生活久久| 欧美日韩五月天| 欧美日韩视频第一区| 欧美日韩一本到| 91精品婷婷国产综合久久性色 | 欧美日韩成人一区二区|