91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 18KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2021-05-09
  • 語言: 其他
  • 標簽:

資源簡介

Wince下socket實現(xiàn)的HTTP類,支持POST和GET

資源截圖

代碼片段和文件信息

/*******************************************************************************
?*?(C)?Copyright?2008?Giant?Electronics?LTD?
?*?
?*?These?computer?program?listings?and?specifications?are?the?property?of?Giant?
?*?Electronics?LTD?and?shall?not?be?reproduced?or?copied?or?used?in?whole?or?in?
?*?part?without?written?permission?from?Giant?Electronics?LTD?.
?*
?*?Project:??????IViewer?
?*?File?Name: ClientHTTP.cpp
?*?Programer(s): Ben?Zhan
?*?Created:??????20080729?
?*?Description: implementation?of?encapsulating?HTTP?protocol
?*?This?class?encapsulates?HTTP?protocol?and?provides?the?functionality?to?request?
?and?read?files?on?an?HTTP?server.
?*******************************************************************************/
#include?“stdafx.h“
#include?“ClientHTTP.h“

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

//////////////////////////////////////////////////////////////////////
//?Construction/Destruction
//////////////////////////////////////////////////////////////////////

CClientHTTP::CClientHTTP()
{
}

CClientHTTP::~CClientHTTP()
{
}

//*******************************************************************************************************???
//???ValidHostChar:?????
//?Return???TRUE???if???the???specified???character???is???valid???
//?for???a???host???name???i.e.???A-Z???or???0-9???or???-.:?????
//*******************************************************************************************************???
BOOL???CClientHTTP::ValidHostChar(TCHAR???ch)???
{???
????return(???iswalpha(ch)???||???iswdigit(ch)||???ch==(‘-‘)???||???ch==(‘.‘)???||???ch==(‘:‘)???);
}

void???CClientHTTP::ParseURL(LPCSTR???urlLPSTR???protocolint???lprotocolLPSTR???hostint???lhostLPSTR???requestint???lrequestint???*port)???
{???
????LPSTR???workptrptr2;
????//added?by?bpan
????//reason:?to?avoid?buffer?overflow
????//2008/09/29
????int?iMinLen;?
????*protocol?=?*host?=?*request?=?0;???
????*port=80;

????work???=???_strdup(url);
????// _strupr(work);??

????ptr???=???strchr(work‘:‘);?//???find???protocol???if???any???
????if(ptr!=NULL)???
????{???
*(ptr++)???=???0;
iMinLen?=?min(lprotocol-1?strlen(work));
strncpy(protocolwork?iMinLen);
????}???
????else???
????{???
iMinLen?=?min(lprotocol?-1?4);
strncpy(protocol“HTTP“?iMinLen);
ptr???=???work;???
????}???
????protocol[iMinLen]?=?TCHAR(‘\0‘);

????if(???(*ptr==‘/‘)???&&???(*(ptr+1)==‘/‘)???)?//???skip???past???opening???/‘s?????
ptr+=2;???

????ptr2???=???ptr;?//???find???host???
????while(???ValidHostChar(*ptr2)???&&???*ptr2???)???
ptr2++;???

????*ptr2=0;???
????iMinLen?=?min(lhost?-1?strlen(ptr));
????strncpy(hostptr?iMinLen);
????host[iMinLen]?=?TCHAR(‘\0‘);
????//lstrcpyn(hostptrlhost);???
????iMinLen?=?min(lrequest?-1?strlen(url?+?(ptr2?-?work)));?
????strncpy(requesturl+(ptr2-work)?iMinLen);?//???find???the???request???
????request[iMinLen]?=?TCH

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件??????14049??2009-03-24?14:03??ClientHTTP.cpp

?????文件???????3377??2009-03-24?14:03??ClientHTTP.h

?????文件???????8118??2009-03-24?14:03??ClientSocket.cpp

?????文件???????2584??2009-03-24?14:03??ClientSocket.h

?????文件???????2268??2009-03-24?14:03??DaemonThread.h

?????文件??????20526??2009-03-24?14:03??Internet.cpp

?????文件???????9685??2009-03-24?14:03??Internet.h

-----------?---------??----------?-----??----

????????????????60607????????????????????7


評論

共有 條評論

相關(guān)資源