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

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

?? http.c

?? Dag Erling http library source code
?? C
?? 第 1 頁 / 共 4 頁
字號:
/*- * Copyright (c) 2000-2004 Dag-Erling Co飀an Sm鴕grav * 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 *    in this position and unchanged. * 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. The name of the author may not be used to endorse or promote products *    derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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>/* * The following copyright applies to the base64 code: * *- * Copyright 1997 Massachusetts Institute of Technology * * Permission to use, copy, modify, and distribute this software and * its documentation for any purpose and without fee is hereby * granted, provided that both the above copyright notice and this * permission notice appear in all copies, that both the above * copyright notice and this permission notice appear in all * supporting documentation, and that the name of M.I.T. not be used * in advertising or publicity pertaining to distribution of the * software without specific, written prior permission.  M.I.T. makes * no representations about the suitability of this software for any * purpose.  It is provided "as is" without express or implied * warranty. * * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''.  M.I.T. DISCLAIMS * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT * SHALL M.I.T. 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/param.h>#include <sys/socket.h>#include <ctype.h>#include <err.h>#include <errno.h>#include <locale.h>#include <netdb.h>#include <stdarg.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <time.h>#include <unistd.h>#include "../include/rmlibhttp.h"#include "cache.h"#include "common.h"#include "httperr.h"/* Maximum number of redirects to follow */#define MAX_REDIRECT 5#define CACHE /* Symbolic names for reply codes we care about */#define HTTP_CONTINUE   100#define HTTP_OK			200#define HTTP_PARTIAL		206#define HTTP_MOVED_PERM		301#define HTTP_MOVED_TEMP		302#define HTTP_SEE_OTHER		303#define HTTP_NEED_AUTH		401#define HTTP_NEED_PROXY_AUTH	407#define HTTP_BAD_RANGE		416#define HTTP_PROTOCOL_ERROR	999#define HTTP_REDIRECT(xyz) ((xyz) == HTTP_MOVED_PERM \			    || (xyz) == HTTP_MOVED_TEMP \			    || (xyz) == HTTP_SEE_OTHER)#define HTTP_ERROR(xyz) ((xyz) > 400 && (xyz) < 599)/***************************************************************************** * I/O functions for decoding chunked streams */#define CONN(io)	((io)->request->conn)struct httpio{	struct http_request_s 	*request;	/* HTTP request */	RMint32			 eof;		/* end-of-file flag */	RMint32			 error;		/* error flag */	RMuint32		 chunksize;	/* remaining size of current chunk */#ifdef HTTP_DEBUG_ENABLED	RMuint32		 total;#endif};static time_t my_timegm (struct tm *tm) {	time_t ret;	RMascii *tz;	tz = getenv("TZ");	setenv("TZ", "", 1);	tzset();	ret = mktime(tm);	if (tz)		setenv("TZ", tz, 1);	else		unsetenv("TZ");	tzset();	return ret;}struct http_request_s {	struct url *url;	const RMascii *op;	struct url *purl;	struct url_stat *us;	RMHTTPFlags flags;	RMint32 chunked;	RMint32 direct;	RMint32 noredirect;	RMint32 verbose;	RMint32 need_auth;	RMint32 open;	RMint32 need_reopen;	RMint64 offset;	RMint64 clength;	RMint64 length;	RMint64 size;			/* Total size of the requested file */	time_t mtime;	RMint32 e;	struct url *new;	conn_t *conn;	RMascii *host;	struct cache_s *cache;	RMint32 last_read_short;	RMascii *custom_header;		/* Custom header for this request */	void *custom_cookie;        	/* Used by custom hooks */	HttpHookOps *custom_hooks;  	/* Used by custom hooks */};static RMint32 __http_get_reply(struct http_request_s *request);static RMint32 __http_get_headers(struct http_request_s *request);static RMint32 __http_send_request(struct http_request_s *request);static RMint32 __http_connect(struct http_request_s *request);static RMint32 _http_single_request(struct http_request_s *request);static RMint32 _http_seekn(void *cookie, RMint64 *position, RMint32 whence);static RMint32 _http_closefn(void *v);static RMint32 _http_readfn(void *v, RMuint8 *buf, RMuint32 len);typedef struct {	void *readfn;	void *writefnL;	void *seekfn;	void *closefn;} httpFileOps_s;static httpFileOps_s p_httpFileOps = { (void *) _http_readfn, (void *) NULL, (void *) _http_seekn, (void *) _http_closefn };void *httpFileOps = &p_httpFileOps;/* Custom header */static RMascii	*fetchCustomHeader = NULL;/* Custom hooks */static void *fetchCustomCookie = NULL;static HttpHookOps *fetchCustomHooks = NULL;/* * Get next chunk header */static RMint32_http_new_chunk(struct httpio *io){	RMascii *p;	if (_fetch_getln(CONN(io)) == -1)		return (-1);	if (CONN(io)->buflen < 2 || !isxdigit(*CONN(io)->buf))		return (-1);	for (p = (RMascii *)CONN(io)->buf; *p && !isspace(*p); ++p) {		if (*p == ';')			break;		if (!isxdigit(*p))			return (-1);		if (isdigit(*p)) {			io->chunksize = io->chunksize * 16 +			    *p - '0';		} else {			io->chunksize = io->chunksize * 16 +			    10 + tolower(*p) - 'a';		}	}#ifdef HTTP_DEBUG_ENABLED	io->total += io->chunksize;	if (io->chunksize == 0)		RMDBGLOG((HTTPDEBUG, "%s(): end of last chunk\n", __func__));	else		RMDBGLOG((HTTPDEBUG, "%s(): new chunk: %lu (%lu)\n",			  __func__, (RMuint32)io->chunksize,			  (RMuint32)io->total));#endif	return (io->chunksize);}/* * Fill the given buffer, do chunk decoding on the fly */static RMint32_http_fillbuf(struct httpio *io, RMuint32 len, RMuint8 *buffer){	RMint32 read;		if (io->error)		return (-1);	if (io->eof)		return (0);	if (io->request->chunked == 0) {		read = _fetch_read(CONN(io), buffer, len);		if (read  < 0){			io->error = 1;			return (-1);		}		return (read);	}	if (io->chunksize == 0) {		switch (_http_new_chunk(io)) {		case -1:			io->error = 1;			return (-1);		case 0:			io->eof = 1;			return (0);		}	}	if (len > io->chunksize)		len = io->chunksize;	read = _fetch_read(CONN(io), buffer, len);	if (read == -1) {		io->error = 1;		return (-1);	}	io->chunksize -= read;	if (io->chunksize == 0) {		RMascii endl[2];		if (_fetch_read(CONN(io), (RMuint8 *)endl, 2) != 2 ||		    endl[0] != '\r' || endl[1] != '\n'){			RMDBGLOG((ENABLE,"No valid chunk separator\n"));			return (-1);		}	}	return (read);}static RMint32 __http_read(void *v, RMuint8 *buf){	struct httpio *io = (struct httpio *)v;	struct http_request_s *request = io->request;	RMint32 status;	RMint32 len = request->url->offset_end - request->url->offset + 1;	RMint32 nread = 0;	RMint32 total_read = 0;	RMint32 hook_read = 0;     /* Used by custom hooks */	RMuint8 *hook_buf = NULL;  /* Used by custom hooks */	if (len == 0)		return 0;		while(1) {		if (request->need_reopen){			RMDBGLOG((HTTPDEBUG,"Need to open a new connection\n"));			status = _fetch_close(request->conn);			if (status < 0)				perror("Error closing previous connection, keep going");			SAFE(__http_connect(request));			/* New connection */			request->need_reopen = 0;			/* Reset the chunk size */			io->chunksize = 0;		}		status = __http_send_request(request);		if (status < 0){			RMDBGLOG((HTTPDEBUG,"Error sending request : %ld, %ld, %ld\n", status, request->conn->err, fetchLastErrCode));			if (fetchLastErrCode == FETCH_OK || fetchLastErrCode == FETCH_PIPE){				/* EPIPE possible if connection is closed by peer */				request->need_reopen = 1;				continue;			}else				return(-1);		}get_reply:		status = __http_get_reply(request);		if (status < 0){			RMDBGLOG((HTTPDEBUG,"Error getting reply : %ld, %ld, %ld\n", status, request->conn->err, fetchLastErrCode));			if (fetchLastErrCode == FETCH_OK){				request->need_reopen = 1;				continue;			}else				return(-1);		}		status = __http_get_headers(request);		if (status < 0){			RMDBGLOG((HTTPDEBUG,"Error getting headers : %ld, %ld, %ld\n", status, request->conn->err, fetchLastErrCode));			if (fetchLastErrCode == FETCH_OK){				request->need_reopen = 1;				continue;			}else				return(-1);		}		if (request->conn->err == HTTP_CONTINUE){			goto get_reply;		}		/* If custom decryption hooks are being used, ... */		if ((request->custom_cookie != NULL) &&		    (request->custom_hooks  != NULL) &&		    (request->custom_hooks->preread  != NULL) &&		    (request->custom_hooks->postread != NULL)) {			RMint32 new_read_size;			RMint32 more_data = 0;			RMint32 result;			/* Resync the decryption block boundary, if necessary */			if (request->custom_hooks->reopen != NULL) {				if ((result = request->custom_hooks->reopen(request->custom_cookie)) < 0)					return result;			}			/* Truncate read size if necessary to prevent reading beyond a decryption block boundary */			if ((new_read_size = request->custom_hooks->preread(request->custom_cookie, buf, len)) <= 0)				return new_read_size;			/* Read the start of the decryption block */			if ((nread = _http_fillbuf(io, new_read_size, buf)) <= 0)				return(-1);			/* Because of HTTP chunking, a second read may be necessary */			if (nread < new_read_size) {				RMint32 delta_read = new_read_size - nread;				if (_http_fillbuf(io, delta_read, buf + delta_read) != delta_read)					return(-1);			}			/* Decrypt the data */			if ((hook_read = request->custom_hooks->postread(request->custom_cookie,									 buf,									 new_read_size,									 &more_data)) <= 0)				return hook_read;			/* Adjust the pointers */			len -= hook_read;			buf += hook_read;			hook_buf = buf;		}		while (len > 0){			nread = _http_fillbuf(io, len, buf);			if (nread <= 0){				RMDBGLOG((ENABLE,"nread <= 0 : %ld\n", total_read));				/* For some servers (Intel DTCPIP for example),				 * a bad range is not a problem, so the request				 * above will not fail at EOF, but the read				 * should at least ... */				if (request->last_read_short){					/* EOF */					io->eof = 1;					return total_read;				}				break;			}			total_read += nread;			len -= nread;			buf += nread;		}		/* If custom decryption hooks are being used, ... */		if ((request->custom_cookie != NULL) &&		    (request->custom_hooks  != NULL) &&		    (request->custom_hooks->preread  != NULL) &&		    (request->custom_hooks->postread != NULL)) {			RMint32 more_data;			RMint32 result;			/* Decrypt the data */			if ((result = request->custom_hooks->postread(request->custom_cookie,								      hook_buf,								      total_read,								      &more_data)) <= 0)				return result;			/* The total read size includes the first read */			total_read += hook_read;		}		if (!total_read && io->error){			RMDBGLOG((ENABLE,"IO error %ld\n", io->error));			return (-1);		}		if (nread == 0){			/* Might be end of file or peer closed connection (time			 * out, ...), so try to reopen, if it was end of file,			 * it will fail */			request->need_reopen = 1;			request->last_read_short = 1;			continue;		}		request->last_read_short = 0;		return(total_read);	}	return(-1);}#define mmin(a,b) ((a)<(b))?(a):(b);static RMint32 __http_read_cached(void *v, RMuint8 *buf, RMuint32 len){	struct httpio *io = (struct httpio *)v;	struct http_request_s *request = io->request;	RMint32 cached, status;	RMuint8 *buf_cache;	RMint32 plen;	RMint64 start_save, end_save;	RMint64 start, offset;	if ((request->url->offset > (request->size - 1)) || len == 0)		return(0);	/* Ensure request offset are valid */	request->url->offset_end = request->url->offset + len - 1;	if (request->url->offset_end > ( request->size - 1 )){

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品国产三级国产aⅴ原创| 日韩精品一区二区三区在线播放 | www.亚洲精品| 久久99国产精品免费| 奇米一区二区三区av| 亚洲成av人片一区二区三区| 一区二区高清免费观看影视大全| 国产精品久久久久久久久免费桃花| 久久久三级国产网站| 久久久久久**毛片大全| 久久久久99精品国产片| 国产精品国产精品国产专区不片| 国产精品久久久久久久蜜臀| 综合欧美一区二区三区| 亚洲综合成人在线视频| 污片在线观看一区二区| 美脚の诱脚舐め脚责91| 国产乱码精品1区2区3区| 成人免费毛片嘿嘿连载视频| 日本伦理一区二区| 欧美一区日韩一区| 国产日韩欧美麻豆| 一区二区三区四区乱视频| 亚洲成人精品在线观看| 麻豆精品一二三| av激情综合网| 欧美一区二区三区视频| 久久久久国产精品厨房| 亚洲一区二区在线免费看| 久久精品国内一区二区三区| 国产成人精品在线看| 欧美视频一区二区三区四区| 精品国产乱码久久久久久浪潮 | 爽好久久久欧美精品| 丝袜亚洲另类丝袜在线| 粉嫩13p一区二区三区| 在线观看视频一区| 亚洲精品一区二区在线观看| 亚洲女与黑人做爰| 美女www一区二区| 91网站视频在线观看| 日韩精品在线一区二区| 亚洲人成网站影音先锋播放| 久久99热99| 在线观看欧美黄色| 国产日韩欧美一区二区三区综合| 亚洲综合无码一区二区| 极品尤物av久久免费看| 欧美日韩午夜在线视频| 中文字幕av一区二区三区| 亚洲地区一二三色| 福利一区二区在线| 91精品国产一区二区三区| 亚洲欧洲综合另类| 国产精品一二三四五| 91精品国产综合久久香蕉的特点 | 日本精品视频一区二区三区| 欧美电影精品一区二区| 亚洲一卡二卡三卡四卡无卡久久 | 一区二区三区精品久久久| 国产美女精品在线| 日韩欧美国产一区在线观看| 亚洲午夜一二三区视频| 99精品黄色片免费大全| 国产精品欧美一级免费| 国产激情一区二区三区| 精品免费日韩av| 日韩电影在线一区| 911精品国产一区二区在线| 亚洲午夜成aⅴ人片| 色婷婷av一区二区三区大白胸 | 亚洲一二三区视频在线观看| 91在线观看美女| 国产精品免费视频观看| 不卡视频在线看| 国产精品国产三级国产aⅴ中文| 国产美女主播视频一区| 久久久亚洲精华液精华液精华液| 蜜桃视频在线一区| 精品精品国产高清一毛片一天堂| 美脚の诱脚舐め脚责91| 日韩欧美国产综合在线一区二区三区| 日韩精品乱码av一区二区| 8v天堂国产在线一区二区| 日本亚洲欧美天堂免费| 精品福利二区三区| 国产成人综合精品三级| 国产精品久久久久影视| 91丝袜国产在线播放| 亚洲一区二区精品久久av| 欧美日韩国产bt| 麻豆国产欧美日韩综合精品二区| 这里只有精品免费| 国产一区二区三区香蕉| 国产精品久久久久影视| 91麻豆swag| 五月天激情综合| www国产亚洲精品久久麻豆| 国产成人精品免费看| 一区二区视频在线| 久久综合成人精品亚洲另类欧美| 国产精品1区2区| 亚洲精品免费看| 日韩亚洲国产中文字幕欧美| 国产成人在线视频网站| 一区二区免费看| 欧美电影免费观看高清完整版在线 | 欧美日韩一区 二区 三区 久久精品| 一区二区三区四区在线| 欧美成人国产一区二区| www.性欧美| 免费成人你懂的| 中文字幕一区二区在线观看| 欧美精品久久99久久在免费线| 国产999精品久久| 日韩黄色免费电影| 国产精品国产三级国产| 欧美一激情一区二区三区| 国产成人精品一区二区三区四区| 夜夜揉揉日日人人青青一国产精品| 日韩免费看的电影| 在线视频综合导航| 国产91对白在线观看九色| 亚洲国产裸拍裸体视频在线观看乱了| 欧美精品一区二区三区在线| 欧美伊人精品成人久久综合97| 国产原创一区二区| 午夜欧美2019年伦理| 欧美—级在线免费片| 欧美一级黄色片| 欧美视频一区二区三区在线观看| 国产成人精品免费在线| 麻豆精品一二三| 天堂资源在线中文精品| 国产精品第一页第二页第三页| 精品日韩在线观看| 在线播放一区二区三区| 色婷婷av一区二区三区之一色屋| 丁香天五香天堂综合| 韩国av一区二区三区四区| 视频一区二区不卡| 亚洲永久免费av| 亚洲日本中文字幕区| 日本一区二区三区四区在线视频 | 成人免费看的视频| 国产美女精品在线| 国内精品伊人久久久久av影院| 首页国产欧美久久| 亚洲不卡在线观看| 亚洲成a人片在线不卡一二三区| 亚洲免费在线观看| 亚洲欧美另类久久久精品2019| 中文字幕国产一区二区| 中文一区在线播放| 国产精品天干天干在线综合| 国产精品区一区二区三区| 国产女同性恋一区二区| 中文字幕av一区二区三区| 中文乱码免费一区二区| 亚洲欧洲日韩女同| 亚洲丝袜另类动漫二区| 成人欧美一区二区三区黑人麻豆| 中文字幕一区二区三区在线观看| 欧美国产丝袜视频| 亚洲天堂av一区| 一区二区三区91| 婷婷综合在线观看| 秋霞午夜av一区二区三区| 理论电影国产精品| 国产伦精品一区二区三区视频青涩 | 国产精品18久久久久| 福利91精品一区二区三区| 成人免费观看视频| 日韩午夜在线影院| 欧美本精品男人aⅴ天堂| 26uuu久久综合| 亚洲欧洲av另类| 亚洲在线成人精品| 激情久久五月天| www.成人网.com| 欧美日韩精品一区二区天天拍小说 | 在线免费观看日本一区| 在线视频欧美精品| 欧美不卡一二三| 中文字幕在线不卡一区 | 国产黑丝在线一区二区三区| 99久久伊人久久99| 欧美日韩一级二级| 久久午夜电影网| 亚洲精品高清在线观看| 男男gaygay亚洲| 91蜜桃在线观看| 精品不卡在线视频| 一区二区三区.www| 国产精品123| 欧美丰满一区二区免费视频| 欧美激情自拍偷拍| 丝袜美腿亚洲一区| 色综合久久中文综合久久97| 欧美大白屁股肥臀xxxxxx|