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

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

?? default.c

?? 嵌入式Linux系統(tǒng)用的web server,開源代碼,非常好用
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*
 * default.c -- Default URL handler. Includes support for ASP.
 *
 * Copyright (c) GoAhead Software Inc., 1995-2000. All Rights Reserved.
 *
 * See the file "license.txt" for usage and redistribution license requirements
 *
 * $Id: default.c,v 1.9 2003/04/11 18:10:28 bporter Exp $
 */

/******************************** Description *********************************/

/*
 *	This module provides default URL handling and Active Server Page support.
 *
 *	In many cases we don't check the return code of calls to websWrite as
 *	it is easier, smaller and non-fatal to continue even when the requesting
 *	browser has gone away.
 */

/********************************* Includes ***********************************/

#include	"wsIntrn.h"

/*********************************** Locals ***********************************/

static char_t	*websDefaultPage;			/* Default page name */
static char_t	*websDefaultDir;			/* Default Web page directory */

/**************************** Forward Declarations ****************************/

static void websDefaultWriteEvent(webs_t wp);

/*********************************** Code *************************************/
/*
 *	Process a default URL request. This will validate the URL and handle "../"
 *	and will provide support for Active Server Pages. As the handler is the
 *	last handler to run, it always indicates that it has handled the URL 
 *	by returning 1. 
 */

int websDefaultHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg,
						char_t *url, char_t *path, char_t *query)
{
	websStatType	sbuf;
	char_t			*lpath, *tmp, *date;
	int				bytes, flags, nchars;

	a_assert(websValid(wp));
	a_assert(url && *url);
	a_assert(path);
	a_assert(query);

/*
 *	Validate the URL and ensure that ".."s don't give access to unwanted files
 */
	flags = websGetRequestFlags(wp);

	if (websValidateUrl(wp, path) < 0) 
   {
      /* 
       * preventing a cross-site scripting exploit -- you may restore the
       * following line of code to revert to the original behavior...
       */
		/*websError(wp, 500, T("Invalid URL %s"), url);*/
      websError(wp, 500, T("Invalid URL"));
		return 1;
	}
	lpath = websGetRequestLpath(wp);
	nchars = gstrlen(lpath) - 1;
	if (lpath[nchars] == '/' || lpath[nchars] == '\\') {
		lpath[nchars] = '\0';
	}

/*
 *	If the file is a directory, redirect using the nominated default page
 */
	if (websPageIsDirectory(lpath)) {
		nchars = gstrlen(path);
		if (path[nchars-1] == '/' || path[nchars-1] == '\\') {
			path[--nchars] = '\0';
		}
		nchars += gstrlen(websDefaultPage) + 2;
		fmtAlloc(&tmp, nchars, T("%s/%s"), path, websDefaultPage);
		websRedirect(wp, tmp);
		bfreeSafe(B_L, tmp);
		return 1;
	}

/*
 *	Open the document. Stat for later use.
 */
	if (websPageOpen(wp, lpath, path, SOCKET_RDONLY | SOCKET_BINARY, 
		0666) < 0) 
   {
      /* 10 Dec 02 BgP -- according to 
       * <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html>, 
       * the proper code to return here is NOT 400 (old code), which is used
       * to indicate a malformed request. Here, the request is good, but the
       * error we need to tell the client about is 404 (Not Found).
       */
      /* 
       * 17 Mar 03 BgP -- prevent a cross-site scripting exploit
		websError(wp, 404, T("Cannot open URL %s"), url);
       */
      
		websError(wp, 404, T("Cannot open URL"));
		return 1;
	} 

	if (websPageStat(wp, lpath, path, &sbuf) < 0) {
      /*
       * 17 Mar 03 BgP
       * prevent a cross-site scripting exploit
		websError(wp, 400, T("Cannot stat page for URL %s"), url);
       */
		websError(wp, 400, T("Cannot stat page for URL"));
		return 1;
	}

/*
 *	If the page has not been modified since the user last received it and it
 *	is not dynamically generated each time (ASP), then optimize request by
 *	sending a 304 Use local copy response
 */
	websStats.localHits++;
#ifdef WEBS_IF_MODIFIED_SUPPORT
	if (flags & WEBS_IF_MODIFIED && !(flags & WEBS_ASP)) {
		if (sbuf.mtime <= wp->since) {
			websWrite(wp, T("HTTP/1.0 304 Use local copy\r\n"));

/*
 *			by license terms the following line of code must
 *			not be modified.
 */
			websWrite(wp, T("Server: %s\r\n"), WEBS_NAME);

			if (flags & WEBS_KEEP_ALIVE) {
				websWrite(wp, T("Connection: keep-alive\r\n"));
			}
			websWrite(wp, T("\r\n"));
			websSetRequestFlags(wp, flags |= WEBS_HEADER_DONE);
			websDone(wp, 304);
			return 1;
		}
	}
#endif

/*
 *	Output the normal HTTP response header
 */
	if ((date = websGetDateString(NULL)) != NULL) {
		websWrite(wp, T("HTTP/1.0 200 OK\r\nDate: %s\r\n"), date);

/*
 *		By license terms the following line of code must not be modified.
 */
		websWrite(wp, T("Server: %s\r\n"), WEBS_NAME);
		bfree(B_L, date);
	}
	flags |= WEBS_HEADER_DONE;

/*
 *	If this is an ASP request, ensure the remote browser doesn't cache it.
 *	Send back both HTTP/1.0 and HTTP/1.1 cache control directives
 */
	if (flags & WEBS_ASP) {
		bytes = 0;
		websWrite(wp, T("Pragma: no-cache\r\nCache-Control: no-cache\r\n"));

	} else {
		if ((date = websGetDateString(&sbuf)) != NULL) {
			websWrite(wp, T("Last-modified: %s\r\n"), date);
			bfree(B_L, date);
		}
		bytes = sbuf.size;
	}

	if (bytes) {
		websWrite(wp, T("Content-length: %d\r\n"), bytes);
		websSetRequestBytes(wp, bytes);
	}
	websWrite(wp, T("Content-type: %s\r\n"), websGetRequestType(wp));

	if ((flags & WEBS_KEEP_ALIVE) && !(flags & WEBS_ASP)) {
		websWrite(wp, T("Connection: keep-alive\r\n"));
	}
	websWrite(wp, T("\r\n"));

/*
 *	All done if the browser did a HEAD request
 */
	if (flags & WEBS_HEAD_REQUEST) {
		websDone(wp, 200);
		return 1;
	}

/*
 *	Evaluate ASP requests
 */
	if (flags & WEBS_ASP) {
		if (websAspRequest(wp, lpath) < 0) {
			return 1;
		}
		websDone(wp, 200);
		return 1;
	}

#ifdef WEBS_SSL_SUPPORT
	if (wp->flags & WEBS_SECURE) {
		websDefaultWriteEvent(wp);
	} else {
		websSetRequestSocketHandler(wp, SOCKET_WRITABLE, websDefaultWriteEvent);
	}
#else
/*
 *	For normal web documents, return the data via background write
 */
	websSetRequestSocketHandler(wp, SOCKET_WRITABLE, websDefaultWriteEvent);
#endif
	return 1;
}


#ifdef WIN32

static int badPath(char_t* path, char_t* badPath, int badLen)
{
   int retval = 0;
   int len = gstrlen(path);
   int i = 0;

   if (len <= badLen +1)
   {
      for (i = 0; i < badLen; ++i)
      {
         if (badPath[i] != gtolower(path[i]))
         {
            return 0;
         }
      }
      /* if we get here, the first 'badLen' characters match.
       * If 'path' is 1 character larger than 'badPath' and that extra 
       * character is NOT a letter or a number, we have a bad path.
       */
      retval = 1;
      if (badLen + 1 == len)
      {
         /* e.g. path == "aux:" */
         if (gisalnum(path[len-1]))
         {
            /* the last character is alphanumeric, so we let this path go 
             * through. 
             */
            retval = 0;
         }
      }
   }

   return retval;
}


static int isBadWindowsPath(char_t** parts, int partCount)
{
   /*
    * If we're running on Windows 95/98/ME, malicious users can crash the 
    * OS by requesting an URL with any of several reserved DOS device names 
    * in them (AUX, NUL, etc.).
    * If we're running on any of those OS versions, we scan the URL 
    * for paths with any of these elements before 
    * trying to access them. If any of the subdirectory names match one
    * of our prohibited links, we declare this to be a 'bad' path, and return 
    * 1 to indicate this. This may be an overly heavy-handed approach, but should 
    * prevent the DOS attack.
    * NOTE that this function is only compiled in when we are running on Win32, 
    * and only has an effect when we are running on Win95/98, or ME. On all other 
    * versions of Windows, we check the version info, and return 0 immediately.
    *
    * According to http://packetstormsecurity.nl/0003-exploits/SCX-SA-01.txt:

    *  II.  Problem Description
    *   When the Microsoft Windows operating system is parsing a path that 
    *   is being crafted like "c:\[device]\[device]" it will halt, and crash 
    *   the entire operating system.  
    *   Four device drivers have been found to crash the system.  The CON,
    *   NUL, AUX, CLOCK$ and CONFIG$ are the two device drivers which are 
    *   known to crash.  Other devices as LPT[x]:, COM[x]: and PRN have not 
    *   been found to crash the system.  
    *   Making combinations as CON\NUL, NUL\CON, AUX\NUL, ... seems to 
    *   crash Ms Windows as well.
    *   Calling a path such as "C:\CON\[filename]" won't result in a crash
    *   but in an error-message.  Creating the map "CON", "CLOCK$", "AUX"
    *   "NUL" or "CONFIG$" will also result in a simple error-message 
    *   saying: ''creating that map isn't allowed''.
    *
    * returns 1 if it finds a bad path element.
    */
   OSVERSIONINFO version;
   int i;
   version.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
   if (GetVersionEx(&version))

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品久久久久久久第一福利| 在线不卡免费av| 欧美激情艳妇裸体舞| 国产美女在线观看一区| 久久综合资源网| 国产精品原创巨作av| 欧美国产精品久久| 成人激情综合网站| 伊人婷婷欧美激情| 欧美日韩精品一区二区三区 | 国产精品免费观看视频| 99这里只有精品| 亚洲成人高清在线| 日韩一区二区电影| 成人免费的视频| 亚洲午夜久久久久久久久电影网| 欧美精选午夜久久久乱码6080| 蜜臀久久99精品久久久久久9| 欧美国产日韩亚洲一区| 91成人网在线| 国产呦萝稀缺另类资源| 最新久久zyz资源站| 日韩亚洲欧美在线| 成人性生交大合| 日日骚欧美日韩| 国产精品毛片久久久久久久| 欧美日韩一区成人| 国产精品白丝jk黑袜喷水| 亚洲欧美综合色| 日韩欧美综合在线| 99re这里都是精品| 九一久久久久久| 亚洲一区二区三区在线播放| 欧美精品一区男女天堂| 一本久久综合亚洲鲁鲁五月天| 老司机精品视频线观看86| 亚洲人成7777| 欧美变态tickling挠脚心| 日本精品一区二区三区高清 | 一区二区不卡在线播放| 精品奇米国产一区二区三区| 色欲综合视频天天天| 精品一区二区在线视频| 一区二区理论电影在线观看| 久久久久久久久久久久久久久99| 欧美日韩一区二区三区高清| 菠萝蜜视频在线观看一区| 久久国产视频网| 亚洲国产精品人人做人人爽| 国产精品女主播av| 精品sm在线观看| 欧美另类高清zo欧美| 色成年激情久久综合| 懂色av一区二区三区蜜臀 | 精品国产91久久久久久久妲己 | 国产在线播精品第三| 无码av免费一区二区三区试看| 中文字幕一区二区日韩精品绯色| 69成人精品免费视频| 欧美亚洲精品一区| 91麻豆国产在线观看| 成人动漫视频在线| 国产精品一区免费在线观看| 另类调教123区| 三级一区在线视频先锋| 亚洲线精品一区二区三区八戒| 樱花影视一区二区| 亚洲男同1069视频| 亚洲麻豆国产自偷在线| 亚洲人123区| 最近日韩中文字幕| 成人欧美一区二区三区小说| 国产精品第四页| 亚洲色图在线视频| 一区二区三区中文字幕精品精品 | 日本韩国欧美三级| 99热这里都是精品| a级高清视频欧美日韩| 波波电影院一区二区三区| 粉嫩av亚洲一区二区图片| 国产成人欧美日韩在线电影| 国产精品一线二线三线精华| 国产精一品亚洲二区在线视频| 国产一区视频在线看| 国产乱国产乱300精品| 国产iv一区二区三区| 成人黄色综合网站| 91麻豆精品一区二区三区| 欧美综合一区二区三区| 欧美区一区二区三区| 日韩视频免费直播| 久久综合狠狠综合久久激情| 国产亚洲精品福利| 亚洲人快播电影网| 亚洲国产cao| 久久99精品国产麻豆不卡| 国产九色精品成人porny| 91伊人久久大香线蕉| 欧美午夜影院一区| 欧美大片顶级少妇| 久久久久国产精品厨房| 亚洲日本免费电影| 青青草精品视频| 懂色av一区二区三区蜜臀| 在线视频国内自拍亚洲视频| 欧美一区二区三区四区视频 | 亚洲丝袜自拍清纯另类| 一区二区三区在线观看视频| 日日嗨av一区二区三区四区| 国产一本一道久久香蕉| 一本大道av一区二区在线播放| 欧美日韩高清影院| 国产亚洲精品aa| 亚洲123区在线观看| 国产麻豆视频一区二区| 欧美中文字幕一区二区三区| 2021国产精品久久精品| 亚洲免费观看在线视频| 精品一区二区三区久久| 在线一区二区三区四区| 久久色中文字幕| 亚洲福利一区二区三区| 国产黄人亚洲片| 欧美色区777第一页| 国产欧美日韩视频一区二区| 三级亚洲高清视频| 色综合天天做天天爱| 精品美女在线观看| 1区2区3区精品视频| 极品少妇xxxx精品少妇| 欧美中文字幕一区| 国产精品看片你懂得| 久久不见久久见免费视频7| 91官网在线观看| 国产精品麻豆久久久| 久久99精品久久久| 678五月天丁香亚洲综合网| 最新热久久免费视频| 国产福利精品导航| 欧美精品一区二区三区蜜桃| 亚洲妇熟xx妇色黄| 91国产丝袜在线播放| 国产精品午夜春色av| 久久99精品久久久| 91精品免费在线| 亚洲超丰满肉感bbw| 在线中文字幕一区二区| 亚洲欧洲国产日韩| 成人涩涩免费视频| 久久免费看少妇高潮| 国产自产高清不卡| 欧美r级在线观看| 天堂在线一区二区| 欧美视频一区二区| 一二三区精品视频| 91视频免费看| 中文字幕一区二| 不卡一卡二卡三乱码免费网站| 久久久久一区二区三区四区| 国产乱码一区二区三区| 久久久91精品国产一区二区三区| 免费观看一级欧美片| 欧美一区二区国产| 日本视频一区二区| 欧美一区二区美女| 麻豆91精品视频| 精品国产一二三| 国产一区91精品张津瑜| 国产婷婷一区二区| 成人教育av在线| 亚洲日本在线看| 欧美视频中文字幕| 日本欧美久久久久免费播放网| 日韩欧美综合在线| 国内精品久久久久影院色| 国产亚洲欧美色| 91免费国产在线| 亚洲国产欧美在线人成| 欧美一区二区三区在线看| 久久国产精品免费| 久久久99久久精品欧美| 99久久er热在这里只有精品66| 一区二区三区四区不卡视频| 欧美日韩精品三区| 久久成人免费网站| 亚洲国产电影在线观看| 色综合天天综合网天天看片| 亚洲v日本v欧美v久久精品| 欧美一级淫片007| 国产98色在线|日韩| 一区二区三区免费看视频| 91超碰这里只有精品国产| 精品一区二区三区日韩| 亚洲视频一区在线| 91精品啪在线观看国产60岁| 国产一区三区三区| 一区二区三区免费看视频| 精品少妇一区二区三区免费观看| 国产成人免费网站| 一区二区免费视频|