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

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

?? httpdoc.cpp

?? 這是一個http服務(wù)器源程序
?? CPP
字號:
// HttpDoc.cpp : implementation of the CHttpSvrDoc class
//
// This is a part of the Microsoft Foundation Classes C++ library.
// Copyright (C) 1997-1998 Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Microsoft Foundation Classes Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Microsoft Foundation Classes product.

#include "stdafx.h"

#include "HttpSvr.h"
#include "HttpDoc.h"
#include "Request.h"
#include "GenPage.h"
#include "NamePage.h"
#include "RootPage.h"
#include "Listen.h"
#include "mainfrm.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CHttpSvrDoc

IMPLEMENT_DYNCREATE(CHttpSvrDoc, CDocument)

BEGIN_MESSAGE_MAP(CHttpSvrDoc, CDocument)
	//{{AFX_MSG_MAP(CHttpSvrDoc)
	ON_COMMAND(IDM_SVR_OPTIONS, OnSvrOptions)
	ON_COMMAND(ID_FILE_RESTART, OnFileRestart)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CHttpSvrDoc construction/destruction

CHttpSvrDoc::CHttpSvrDoc()
{
	m_pListen = NULL;
}

CHttpSvrDoc::~CHttpSvrDoc()
{
	// get rid of any lingering requests, JIC.....
	while ( !m_reqList.IsEmpty() )
	{
		CRequest* pRequest = (CRequest*)(m_reqList.RemoveTail());
		pRequest->Release();
	}
}

BOOL CHttpSvrDoc::OnNewDocument()
{
	CDocument::OnNewDocument();

	// zero the hits counter....
	m_nTotalHits = 0;
	// assign default values....
	m_strServer = ((CHttpSvrApp*)AfxGetApp())->m_strDefSvr;
	m_uPort = PORT_HTTP;
	m_nSvrName = 0;
	m_bLoggingOn = TRUE;
	m_bAllowListing = TRUE;
	m_bListIcon = TRUE;

	// get the default root path....
	m_strRoot.LoadString( IDS_DEF_ROOT );
	m_strRoot = SEPCHAR + m_strRoot;
	// ensure no final separator character....
	if ( m_strRoot[m_strRoot.GetLength()-1] == SEPCHAR )
		m_strRoot = m_strRoot.Left( m_strRoot.GetLength()-1 );
	// make into a full path string....
	GetFullPathName( m_strRoot, MAX_PATH,
		m_strRoot.GetBuffer(MAX_PATH), NULL);
	m_strRoot.ReleaseBuffer();

	// see if we need to automatically disable the icons
	// in folder listings....
	CString strAdmin = m_strRoot + SEPCHAR + "SvrAdmin";
	DWORD dwAttr = GetFileAttributes( strAdmin );
	if ( dwAttr == (DWORD)(-1) || (dwAttr & FILE_ATTRIBUTE_DIRECTORY) == 0 )
		m_bListIcon = FALSE; // don't allow icons

	StartListening();
	SetTitle( NULL );
	return TRUE;
}

BOOL CHttpSvrDoc::OnOpenDocument(LPCTSTR lpszPathName)
{
	BOOL bOk = FALSE;
	if ( CDocument::OnOpenDocument(lpszPathName) )
	{
		if ( (bOk = StartListening()) == FALSE )
			SetModifiedFlag( TRUE );
	}

	return bOk;
}

/////////////////////////////////////////////////////////////////////////////
// CHttpSvrDoc serialization

void CHttpSvrDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		ar << m_strRoot;
		ar << m_strServer;
		ar << m_timeStarted;
		ar << m_uPort;
		ar << m_nSvrName;
		ar << m_bLoggingOn;
		ar << m_bListIcon;
		ar << m_bAllowListing;
	}
	else
	{
		ar >> m_strRoot;
		ar >> m_strServer;
		ar >> m_timeStarted;
		ar >> m_uPort;
		ar >> m_nSvrName;
		ar >> m_bLoggingOn;
		ar >> m_bListIcon;
		ar >> m_bAllowListing;

		if ( m_nSvrName == 0 )
			m_strServer = ((CHttpSvrApp*)AfxGetApp())->m_strDefSvr;
	}
}

/////////////////////////////////////////////////////////////////////////////
// CHttpSvrDoc diagnostics

#ifdef _DEBUG
void CHttpSvrDoc::AssertValid() const
{
	CDocument::AssertValid();
}

void CHttpSvrDoc::Dump(CDumpContext& dc) const
{
	CDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CHttpSvrDoc commands

void CHttpSvrDoc::DocHit( CRequest* pRequest )
{
	// save the request object....
	pRequest->AddRef();
	m_reqList.AddTail( pRequest );
	// increment the total hit count....
	++m_nTotalHits;
	// tell the view we got a new doc hit....
	UpdateAllViews( NULL, HINT_DOCHIT, pRequest );
}

BOOL CHttpSvrDoc::IdleProc( LONG lCount )
{
	BOOL bMore = FALSE;
	// if there's still requests in the list....
	if ( !m_reqList.IsEmpty() )
	{
		// pull off the first item....
		CRequest* pRequest = (CRequest*)(m_reqList.RemoveHead());
		// if it's done....
		if ( pRequest->m_bDone )
		{
			// process it for the stats....
			ExtractStats( pRequest );
			// done with it....
			pRequest->Release();
			// more idle needed if not empty....
			bMore = !m_reqList.IsEmpty();
		}
		else
		{
			// move to end of list....
			m_reqList.AddTail( pRequest );
			// still need to come back....
			bMore = TRUE;
		}
	}
	return bMore;
}

void CHttpSvrDoc::ExtractStats( CRequest* pRequest )
{
	// increment the status' group count....
	if ( pRequest->m_uStatus >= 100 && pRequest->m_uStatus < 600 )
		++m_aReStats[ pRequest->m_uStatus/100 - 1 ];
	else
		++m_aReStats[ STATUS_SERVERERR ]; // JIC

	// see if we want to write entry in log file....
	if ( m_bLoggingOn )
	{
		CString strLog;
		strLog.Format( IDS_STATUSFMT, pRequest->m_uStatus );
		strLog += pRequest->m_strHost + '\t'
			+ pRequest->m_timeReq.Format( IDS_TIMEFORMAT ) + '\t'
			+ pRequest->m_strURL + ' ';
		if ( !pRequest->m_strArgs.IsEmpty() )
			strLog += CString("? ") + pRequest->m_strArgs;

		strLog += '\n';
		CString strLogName = m_strTitleBase + pRequest->m_timeReq.Format(IDS_LOGFILEFMT);
		CStdioFile fileLog( strLogName,
			CFile::modeWrite | CFile::modeCreate |
			CFile::modeNoTruncate | CFile::shareExclusive );
		// see if file is new and we need to write the header....
		if ( fileLog.SeekToEnd() == 0 )
		{
			// write page header.....
			CString strHeader;
			strHeader.Format( IDS_LOG_HEADER, pRequest->m_timeReq.Format(IDS_LONG_DATE) );
			fileLog.Write( strHeader, strHeader.GetLength() );
		}
		fileLog.Write( strLog, strLog.GetLength() );
		fileLog.Close();
	}
}


void CHttpSvrDoc::OnCloseDocument()
{
	StopListening();
	CDocument::OnCloseDocument();
}

void CHttpSvrDoc::SetTitle(LPCTSTR lpszTitle)
{
	CString strTitle;
	if ( lpszTitle != NULL )
		m_strTitleBase = lpszTitle;

	if ( m_strServer.IsEmpty() )
		strTitle = m_strTitleBase;
	else if ( m_pListen == NULL )
		strTitle.Format( IDS_INVALID, m_strTitleBase );
	else
	{
		if ( m_uPort != PORT_HTTP )
			strTitle.Format( IDS_DOCTITLE, m_strTitleBase, m_strServer, m_uPort );
		else
			strTitle.Format( IDS_DOCTITLE_NOPORT, m_strTitleBase, m_strServer );
	}

	CDocument::SetTitle( strTitle );
}

void CHttpSvrDoc::OnSvrOptions()
{
	// add and initialize the general page....
	CPropertySheet propOptions( IDS_OPTIONS );
	CGenPage genPage( this );
	genPage.m_bListIcon = m_bListIcon;
	genPage.m_bAllowListing = m_bAllowListing;
	genPage.m_bLoggingOn = m_bLoggingOn;
	propOptions.AddPage( &genPage );

	// add and initialize the root dir page....
	CRootPage rootPage( this );
	rootPage.m_strRoot = m_strRoot;
	propOptions.AddPage( &rootPage );

	// add and initialize the name page....
	CNamePage namePage( this );
	namePage.m_nNameSetting = m_nSvrName;
	namePage.m_uPort = m_uPort;
	if ( m_nSvrName )
		namePage.m_strName = m_strServer;
	propOptions.AddPage( &namePage );

	m_bResetListen = FALSE;
	propOptions.DoModal();
	if ( m_bResetListen )
	{
		StartListening();
		SetTitle( NULL );
	}
}

void CHttpSvrDoc::StopListening( void )
{
	if ( m_pListen != NULL )
	{
		m_pListen->Close();
		delete m_pListen;
		m_pListen = NULL;
	}
}

BOOL CHttpSvrDoc::StartListening( void )
{
	BOOL bOk = FALSE;
	StopListening();
	m_pListen = new CListenSocket( this );
	if ( m_pListen )
	{
		if ( m_pListen->Create( m_uPort, SOCK_STREAM, FD_ACCEPT ) )
			bOk = m_pListen->Listen();

		if ( !bOk )
		{
			CString strMsg;
			int nErr = m_pListen->GetLastError();
			if ( nErr == WSAEADDRINUSE )
				strMsg.Format( IDS_LISTEN_INUSE, m_uPort );
			else
				strMsg.Format( IDS_LISTEN_ERROR, m_uPort );

			AfxMessageBox( strMsg, MB_OK|MB_ICONSTOP );
			m_pListen->Close();
			delete m_pListen;
			m_pListen = NULL;
		}
	}
	else
		AfxMessageBox( IDS_CANT_LISTEN, MB_OK|MB_ICONSTOP );

	m_timeStarted = CTime::GetCurrentTime();

	return bOk;
}



void CHttpSvrDoc::OnFileRestart()
{
	// this will close the connection if it's already open
	// before starting again....
	StartListening();
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久99精品国产.久久久久久| 首页国产欧美日韩丝袜| 欧美一区永久视频免费观看| 激情综合五月婷婷| 中文字幕色av一区二区三区| 欧美视频在线观看一区二区| 国产成人免费高清| 亚洲va韩国va欧美va| 欧美猛男gaygay网站| 成人激情免费电影网址| 亚洲综合色成人| 日韩欧美中文一区二区| 91在线码无精品| 蜜乳av一区二区| 亚洲一区电影777| 欧美高清在线一区二区| 欧美夫妻性生活| 在线观看网站黄不卡| 国产一区啦啦啦在线观看| 综合电影一区二区三区| 久久久精品综合| 欧美老肥妇做.爰bbww| 国产福利精品一区| 天天av天天翘天天综合网色鬼国产| 久久蜜桃一区二区| 欧美不卡在线视频| 欧美日韩激情一区二区| 成人av午夜电影| 成人精品在线视频观看| 日本aⅴ免费视频一区二区三区| 久久综合色鬼综合色| 日韩免费观看高清完整版| 日本韩国一区二区三区| 99国产精品一区| 国产成人精品一区二区三区网站观看| 污片在线观看一区二区| 天天做天天摸天天爽国产一区 | 成人精品国产免费网站| 久久国产精品免费| 另类的小说在线视频另类成人小视频在线| 1024成人网| 日本一区二区在线不卡| 国产精品水嫩水嫩| 中文av一区特黄| 国产婷婷色一区二区三区在线| 国产欧美一区二区精品秋霞影院 | 日韩欧美国产不卡| 91麻豆精品国产| 欧美日韩亚洲综合一区二区三区| 国产成人99久久亚洲综合精品| 国产999精品久久久久久绿帽| 成人av电影在线观看| 成人激情小说乱人伦| 成人激情午夜影院| www.亚洲色图| 色婷婷久久综合| 色视频欧美一区二区三区| 欧美视频一区在线| 欧美日韩国产综合视频在线观看 | 一本一道久久a久久精品综合蜜臀| jvid福利写真一区二区三区| 丁香婷婷综合激情五月色| 国产中文字幕精品| a级精品国产片在线观看| 成人一区在线看| 欧美亚洲图片小说| 欧美精品在线观看播放| 欧美一卡二卡在线观看| 国产日韩欧美精品一区| 国产精品久久夜| 国产精品国产三级国产a| 亚洲高清免费一级二级三级| 亚洲成人动漫在线观看| 日日夜夜精品视频天天综合网| 免费成人av资源网| 精品一区二区免费看| 成人毛片老司机大片| 在线观看日韩精品| 久久亚洲综合色| 亚洲天堂中文字幕| 一区二区三区影院| 国内精品伊人久久久久av一坑| 国产一区在线精品| 欧美视频精品在线| 精品人在线二区三区| 欧美韩日一区二区三区四区| 亚洲一区欧美一区| 麻豆免费精品视频| 99国产精品视频免费观看| 欧美日韩高清一区二区不卡| 精品国产不卡一区二区三区| 亚洲激情综合网| 久久精品999| 国产成人啪午夜精品网站男同| 欧美视频第二页| 精品播放一区二区| 亚洲va韩国va欧美va| 国产精品亚洲第一区在线暖暖韩国 | 日韩三区在线观看| 日韩三级视频在线观看| 国产精品久久精品日日| 日本vs亚洲vs韩国一区三区二区| 成人午夜免费电影| 欧美中文字幕亚洲一区二区va在线| 欧美一区二区高清| 中文字幕制服丝袜成人av | 视频一区免费在线观看| 国产精品一区专区| 欧美日韩国产综合草草| 国产人成亚洲第一网站在线播放| 亚洲午夜影视影院在线观看| av在线播放成人| 日韩欧美专区在线| 中文字幕欧美激情一区| 久久99这里只有精品| 日本乱人伦aⅴ精品| 中文字幕在线一区免费| 久久精品国产免费| 99久久国产综合精品麻豆| 国产三级精品视频| 日本vs亚洲vs韩国一区三区二区| 欧美伊人久久大香线蕉综合69| 国产亚洲精品资源在线26u| 午夜不卡av在线| 欧美偷拍一区二区| 亚洲欧洲制服丝袜| 成人av动漫网站| 国产午夜精品一区二区三区视频 | 一区二区三区美女| 福利电影一区二区| 欧美日韩国产首页| 婷婷开心久久网| 91福利在线看| 一二三区精品视频| 色哟哟一区二区在线观看| 欧美白人最猛性xxxxx69交| 日韩经典一区二区| 欧美日韩一卡二卡| 婷婷久久综合九色国产成人| 在线视频国内一区二区| 中文字幕一区二区三| www..com久久爱| 日本一二三四高清不卡| 麻豆成人在线观看| 日韩美女一区二区三区四区| 日韩黄色在线观看| 欧美va亚洲va国产综合| 蜜桃av噜噜一区| 欧美日韩一级二级三级| 日本欧美在线观看| 欧美一区二区三区四区五区| 极品美女销魂一区二区三区免费| 欧美视频一区二区三区在线观看| 国产精品视频免费| 91成人国产精品| 亚洲国产成人va在线观看天堂| 欧美精品色一区二区三区| 青青青伊人色综合久久| 欧美日韩卡一卡二| 日本亚洲最大的色成网站www| 欧美一区二区视频观看视频| 亚洲国产精品久久久久秋霞影院| bt欧美亚洲午夜电影天堂| 一区二区在线免费| 欧美羞羞免费网站| 国精产品一区一区三区mba桃花| 精品欧美一区二区在线观看| 久久99精品国产.久久久久| 久久久高清一区二区三区| 成人综合婷婷国产精品久久| 男人的j进女人的j一区| 精品国产伦一区二区三区免费| 粉嫩嫩av羞羞动漫久久久| 亚洲婷婷在线视频| 欧美视频一区二区三区四区| 国内成+人亚洲+欧美+综合在线| 国产日韩欧美a| 色偷偷久久人人79超碰人人澡| 婷婷一区二区三区| 日韩欧美国产综合在线一区二区三区 | 成人在线综合网站| 天天综合网天天综合色| 亚洲精品一区在线观看| 成人一区二区三区视频 | 精品国产乱码久久久久久牛牛 | 4438x亚洲最大成人网| 国产美女av一区二区三区| 国产精品网曝门| 欧美一区二区黄色| 成人理论电影网| 久久国产精品72免费观看| 中文字幕av不卡| 欧美三级电影网| 不卡av在线免费观看| 天堂久久一区二区三区| 日本一二三四高清不卡| 8v天堂国产在线一区二区| 成人国产亚洲欧美成人综合网| 天堂在线一区二区| xvideos.蜜桃一区二区|