锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久久久免费观看,欧美一区二区三区的,免费在线看一区http://www.shnenglu.com/zhupf/archive/2013/07/02/201459.htmlzhupfzhupfTue, 02 Jul 2013 06:44:00 GMThttp://www.shnenglu.com/zhupf/archive/2013/07/02/201459.htmlhttp://www.shnenglu.com/zhupf/comments/201459.htmlhttp://www.shnenglu.com/zhupf/archive/2013/07/02/201459.html#Feedback0http://www.shnenglu.com/zhupf/comments/commentRss/201459.htmlhttp://www.shnenglu.com/zhupf/services/trackbacks/201459.html
#include "windows.h"
#include "winhttp.h"
#include "wchar.h"
#pragma comment(lib,"Winhttp.lib")
// SSL (Secure Sockets Layer) example
// compile for console
void main()
{
HINTERNET hOpen = 0;
HINTERNET hConnect = 0;
HINTERNET hRequest = 0;
IStream *stream = NULL;
HRESULT hr;
while (1)
{
hOpen = WinHttpOpen(L"Aurora Console App", WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,
WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0);
if (!hOpen) {
wprintf(L"WinHttpOpen failed (0x%.8X)\n", GetLastError());
break;
}
hConnect = WinHttpConnect(hOpen, L"raw.github.com", INTERNET_DEFAULT_HTTPS_PORT, 0);
if (!hConnect) {
wprintf(L"WinHttpConnect failed (0x%.8X)\n", GetLastError());
break;
}
LPCWSTR types[2];
types[0] = L"text/html";
types[1] = 0;
// use flag WINHTTP_FLAG_SECURE to initiate SSL
hRequest = WinHttpOpenRequest(hConnect, L"GET", L"zpfzzz/test/master/README.md",
NULL, WINHTTP_NO_REFERER, &types[0], WINHTTP_FLAG_SECURE);
if (!hRequest)
{
wprintf(L"WinHttpOpenRequest failed (0x%.8X)\n", GetLastError());
break;
}
if (!WinHttpSendRequest(hRequest, WINHTTP_NO_ADDITIONAL_HEADERS, 0, WINHTTP_NO_REQUEST_DATA, 0, 0, 0))
{
wprintf(L"WinHttpSendRequest failed (0x%.8X)\n", GetLastError());
break;
}
if (!WinHttpReceiveResponse(hRequest, 0))
{
wprintf(L"WinHttpReceiveResponse failed (0x%.8X)\n", GetLastError());
break;
}
// query remote file size, set haveContentLength on success and dwContentLength to the length
wchar_t szContentLength[32];
DWORD cch = 64;
DWORD dwHeaderIndex = WINHTTP_NO_HEADER_INDEX;
BOOL haveContentLength = WinHttpQueryHeaders(hRequest, WINHTTP_QUERY_CONTENT_LENGTH, NULL,
&szContentLength, &cch, &dwHeaderIndex);
DWORD dwContentLength;
if (haveContentLength) dwContentLength = _wtoi(szContentLength);
// read the response into memory stream
hr = CreateStreamOnHGlobal(0, true, &stream);
if (hr) {
wprintf(L"CreateStreamOnHGlobal failed (0x%.8X)\n", hr);
break;
}
// allocate buffer for streaming received data
char *p = new char[4096];
if (!p)
{
wprintf(L"failed to allocate buffer\n");
break;
}
// to receive all data, we need to enter a loop
DWORD dwReceivedTotal = 0;
while (WinHttpQueryDataAvailable(hRequest, &cch) && cch)
{
if (cch > 4096) cch = 4096;
dwReceivedTotal += cch;
// display number of received bytes
if (haveContentLength)
{
wprintf(L"received %d of %d (%d%%)%c", dwReceivedTotal, dwContentLength, 
dwReceivedTotal*100/dwContentLength, 13);
}
else {
wprintf(L"received %d (unknown length)%c", dwReceivedTotal, 10);
}
WinHttpReadData(hRequest, p, cch, &cch);
// write into stream
hr = stream->Write(p, cch, NULL);
if (hr)
{
wprintf(L"failed to write data to stream (0x%.8X)\n", hr);
}
}
delete [] p;
wprintf(L"\n\nreceived all data.\n");
// terminate the sream with a NULL
p = NULL;
stream->Write(&p, 1, NULL);
// get pointer to stream bytes
wprintf(L"getting HGLOBAL from stream...\n");
HGLOBAL hgl;
hr = GetHGlobalFromStream(stream, &hgl);
if (hr) {
wprintf(L"GetHGlobalFromStream failed (0x%.8X)\n", hr);
break;
}
wprintf(L"locking memory...\n");
p = (char*)GlobalLock(hgl);
if (!p)
{
wprintf(L"GlobalLock failed (0x%.8X)\n", GetLastError());
break;
}
wprintf(L"displaying received data...\n");
// terminate the string at 1024 bytes (MessageBox lag)
//if (dwReceivedTotal > 1024) dwReceivedTotal = 1024;
//*p[dwReceivedTotal] = 0;
MessageBoxA(0, p, "", 0);
GlobalUnlock(hgl);
break;
}
// delete stream and close handles
if (stream) stream->Release();
if (hRequest) WinHttpCloseHandle(hRequest);
if (hConnect) WinHttpCloseHandle(hConnect);
if (hOpen) WinHttpCloseHandle(hOpen);
system("pause");
}


zhupf 2013-07-02 14:44 鍙戣〃璇勮
]]>
国产精品久久婷婷六月丁香| 久久精品国产亚洲AV嫖农村妇女| 精品综合久久久久久88小说| 91精品国产综合久久精品| 国产成人99久久亚洲综合精品 | 久久精品一本到99热免费| 久久99免费视频| 一本大道久久东京热无码AV| 久久亚洲精品成人AV| 亚洲国产成人久久笫一页| 99久久99久久精品免费看蜜桃| 久久综合丁香激情久久| 2021久久精品免费观看| 久久99精品国产99久久6男男| 中文字幕精品无码久久久久久3D日动漫 | 欧洲性大片xxxxx久久久| AAA级久久久精品无码片| 亚洲人成电影网站久久| 国产精品99久久久久久董美香| 伊人久久大香线蕉av不变影院| 久久99精品国产麻豆婷婷| 久久se精品一区精品二区| 奇米影视7777久久精品| 欧美激情精品久久久久久久九九九| 国产成年无码久久久久毛片| 精品一二三区久久aaa片| 久久久无码精品亚洲日韩京东传媒| 国产精品日韩深夜福利久久| 久久91综合国产91久久精品| 久久亚洲精品中文字幕| 久久人妻少妇嫩草AV无码专区| 97久久国产综合精品女不卡| 久久久久久久免费视频| 久久婷婷色香五月综合激情| 日韩欧美亚洲国产精品字幕久久久 | 久久亚洲春色中文字幕久久久 | 亚州日韩精品专区久久久| 久久强奷乱码老熟女网站| 久久久久亚洲精品男人的天堂| 国产精品青草久久久久福利99| 亚洲天堂久久精品|