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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? wintransportagent.cpp

?? funambol windows mobile plugin source code, the source code is taken from the funambol site
?? CPP
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
        }

        #if defined(WIN32) && !defined(_WIN32_WCE)
        //
        // Proxy Authentication Required (407) / Server Authentication Required (401).
        // Need to set username/password.
        //
        else if(status == HTTP_STATUS_PROXY_AUTH_REQ ||
                status == HTTP_STATUS_DENIED) {
            LOG.debug("HTTP Authentication required.");
            DWORD dwError;

            // Automatic authentication (user/pass stored in win reg key).
            if (strcmp(proxy.user, "") && strcmp(proxy.password, "")) {
                WCHAR* wUser = toWideChar(proxy.user);
                WCHAR* wPwd  = toWideChar(proxy.password);

                InternetSetOption(request, INTERNET_OPTION_PROXY_USERNAME, wUser, wcslen(wUser)+1);
                InternetSetOption(request, INTERNET_OPTION_PROXY_PASSWORD, wPwd,  wcslen(wPwd)+1);

                delete [] wUser;
                delete [] wPwd;
                dwError = ERROR_INTERNET_FORCE_RETRY;
            }

            // Prompt dialog box.
            else {
                dwError = InternetErrorDlg(GetDesktopWindow(), request, NULL,
                                           FLAGS_ERROR_UI_FILTER_FOR_ERRORS |
                                           FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS |
                                           FLAGS_ERROR_UI_FLAGS_GENERATE_DATA,
                                           NULL);
            }

            if (dwError == ERROR_INTERNET_FORCE_RETRY) {
                continue;
            }
            else {
                LOG.error("HTTP Authentication failed.");
                break;
            }
        }
        #endif  // #if defined(WIN32) && !defined(_WIN32_WCE)
        
        else if (status == HTTP_ERROR) {                    // 400 bad request error. retry to send the message
            LOG.info("Network error in server receiving data. "
                     "Server responds 400: retry %i time...", numretries + 1);
            continue;
        }
        else if (status == HTTP_STATUS_SERVER_ERROR ) {     // 500 -> out code 2052
            lastErrorCode = ERR_SERVER_ERROR;
            sprintf(lastErrorMsg, "HTTP server error: %d. Server failure.", status);
            LOG.debug(lastErrorMsg);
            goto exit;
        }

        #ifdef _WIN32_WCE
        // To handle the http error code for the tcp/ip notification with wrong credential
        else if (status == ERR_CREDENTIAL) {                // 401 -> out code 401
            lastErrorCode = ERR_CREDENTIAL;
            sprintf(lastErrorMsg, "HTTP server error: %d. Wrong credential.", status);
            LOG.debug(lastErrorMsg);
            goto exit;
        }
        // to handle the http error code for the tcp/ip notification and client not notifiable
        else if (status == ERR_CLIENT_NOT_NOTIFIABLE) {     // 420 -> out code 420
            lastErrorCode = ERR_CLIENT_NOT_NOTIFIABLE;
            sprintf(lastErrorMsg, "HTTP server error: %d. Client not notifiable.", status);
            LOG.debug(lastErrorMsg);
            goto exit;
        }
        #endif
        
        else if (status == HTTP_STATUS_NOT_FOUND) {         // 404 -> out code 2060
            lastErrorCode = ERR_HTTP_NOT_FOUND;
            sprintf(lastErrorMsg, "HTTP request error: resource not found (status %d)", status);
            LOG.debug(lastErrorMsg);
            goto exit;
        }
        else if (status == HTTP_STATUS_REQUEST_TIMEOUT) {   // 408 -> out code 2061
            lastErrorCode = ERR_HTTP_REQUEST_TIMEOUT;
            sprintf(lastErrorMsg, "HTTP request error: server timed out waiting for request (status %d)", status);
            LOG.debug(lastErrorMsg);
            goto exit;
        }
        else {
            // Other HTTP errors -> OUT
            lastErrorCode = ERR_HTTP_STATUS_NOT_OK;         // else -> out code 2053
            DWORD code = GetLastError();
            char* tmp = createHttpErrorMessage(code);
            sprintf(lastErrorMsg, "HTTP request error: status received = %d): %s (code %d)", status, tmp, code);
		    LOG.debug(lastErrorMsg);
		    delete [] tmp;
		    goto exit;
        }
    } // for(numretries = 0; numretries < MAX_RETRIES; numretries++)
    

    // Too much retries -> exit
    if (numretries == MAX_RETRIES) {                        // Network error -> out code 2001
        lastErrorCode = ERR_CONNECT;
        sprintf(lastErrorMsg, "HTTP request error: %d attempts failed.", numretries);
        LOG.error(lastErrorMsg);
        goto exit;
    }

    //Initialize response
    contentLength=0;
    HttpQueryInfo (request,
                   HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER,
                   (LPDWORD)&contentLength,
                   (LPDWORD)&size,
                   NULL);



#ifdef USE_ZLIB
    int uncompressedContentLenght = 0;

    if(compression){
        // Release the send buffer (also set msgToSend to NULL, to
        // avoid leaving a dangling pointer around.
	    if (compr) {
	            delete [] compr; compr = NULL;
	            msgToSend = NULL;
	    }
	
	    //
	    // Read headers: get contentLenght/Uncompressed-Content-Length.
	    //
	    wbuffer = new WCHAR[1024];
	    DWORD ddsize = 1024;
	    if (!HttpQueryInfo(request,HTTP_QUERY_RAW_HEADERS_CRLF ,(LPVOID)wbuffer,&ddsize,NULL)) {
	        if (ERROR_HTTP_HEADER_NOT_FOUND == GetLastError()) {
	            isToDeflate = FALSE;
	        }
	    }
	    LOG.debug("Header: %ls", wbuffer);
	    delete [] wbuffer; wbuffer = NULL;
	
	    // isToDeflate to be set
	    DWORD dwSize = 512;
	    buffer = new WCHAR[dwSize];
	    memset(buffer, 0, dwSize*sizeof(WCHAR));
	
	    wcscpy(buffer, TEXT("Accept-Encoding"));
	    HttpQueryInfo(request, HTTP_QUERY_CUSTOM, (LPVOID)buffer, &dwSize, NULL);
	    if (GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND) {
	        isToDeflate = FALSE;
	    } else {
	        isToDeflate = TRUE;
	    }
	
	    memset(buffer, 0, dwSize*sizeof(WCHAR));
	    wcscpy(buffer, TEXT("Content-Encoding"));
	    HttpQueryInfo(request, HTTP_QUERY_CUSTOM, (LPVOID)buffer, &dwSize, NULL);
	    if (GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND) {
	        isToInflate = FALSE;
	    } else {
	        if (wcscmp(buffer, TEXT("deflate")) == 0)
	            isToInflate = TRUE;
	        else
	            isToInflate = FALSE;
	    }

	    if(isToInflate) {
	    	memset(buffer, 0, dwSize*sizeof(WCHAR));
	    	wcscpy(buffer, TEXT("Uncompressed-Content-Length"));
	
	    	HttpQueryInfo(request, HTTP_QUERY_CUSTOM, (LPVOID)buffer, &dwSize, NULL);
                if (GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND) {
                    LOG.error("Error reading 'Uncompressed-Content-Length' header.");
                    uncompressedContentLenght = -1;
                }
                else {
                    uncompressedContentLenght = wcstol(buffer, NULL, 10);
                    LOG.debug("Uncompressed-Content-Length: %ld", uncompressedContentLenght);
                }

                // Check header value, use MAX_MSG_SIZE if not valid.
                if(uncompressedContentLenght <= 0) {
                    LOG.error("Invalid value, using max message size.");
                    uncompressedContentLenght = maxmsgsize * 2;
                }

            }
	
	    delete [] buffer;
	    buffer = NULL;
    }  //end if compression
#endif


//
// ====================================== Reading Response ======================================
//
    LOG.debug(READING_RESPONSE);
    LOG.debug("Content-length: %u", contentLength);

    if (contentLength <= 0) {
        LOG.debug("Undefined content-length = %u. Using the maxMsgSize = %u.", contentLength, maxmsgsize);
        contentLength = maxmsgsize;
    }

    // Allocate a block of memory for response read.
    response = new char[contentLength+1];
    if (response == NULL) {
        lastErrorCode = ERR_NOT_ENOUGH_MEMORY;
        sprintf(lastErrorMsg, "Not enough memory to allocate a buffer for the server response: %d required.", contentLength);
        LOG.error(lastErrorMsg);
        goto exit;
    }
    memset(response, 0, contentLength);
	p = response;
    int realResponseLenght = 0;

    // Fire Data Received Transport Event.
    fireTransportEvent(contentLength, RECEIVE_DATA_BEGIN);

    do {
        if (!InternetReadFile(request, (LPVOID)bufferA, readBufferSize, &read)) {
            DWORD code = GetLastError();
            lastErrorCode = ERR_READING_CONTENT;
            char* tmp = createHttpErrorMessage(code);
            sprintf(lastErrorMsg, "InternetReadFile Error: %d - %s", code, tmp);
            delete [] tmp;
            goto exit;
		}

        // Sanity check: some proxy could send additional bytes.
        // Correct 'read' value to be sure we won't overflow the 'response' buffer.
        if ((realResponseLenght + read) > contentLength) {
            LOG.debug("Warning! %d bytes read -> truncating data to content-lenght = %d.", (realResponseLenght + read), contentLength);
            read = contentLength - realResponseLenght;
        }

        if (read > 0) {
            memcpy(p, bufferA, read);               // Note: memcopy exactly the bytes read (could be no readable chars...)
            p += read;
            realResponseLenght += read;

            // Fire Data Received Transport Event
            fireTransportEvent(read, DATA_RECEIVED);
        }

    } while (read);

    // free read buffer
    delete [] bufferA; bufferA = NULL;

    if (realResponseLenght <= 0) {
        lastErrorCode = ERR_READING_CONTENT;
        sprintf(lastErrorMsg, "Error reading HTTP response from Server: received data of size = %d.", realResponseLenght);
        goto exit;
    }

    // Log bytes read if different from content length
    // (should be already the same...)
    if (realResponseLenght != contentLength) {
        LOG.info("Bytes read: ", realResponseLenght);
    	contentLength = realResponseLenght;
    }

    // Fire Receive Data End Transport Event
    fireTransportEvent(contentLength, RECEIVE_DATA_END);

    //------------------------------------------------------------- Response read

#ifdef USE_ZLIB
    if(compression){
	    if (isToInflate) {
	        //
	        // INFLATE (decompress data)
	        //
	        uLong uncomprLen = uncompressedContentLenght;
	        Bytef* uncompr = new Bytef[uncomprLen + 1];
	
	        // Decompresses the source buffer into the destination buffer.
	        int err = uncompress(uncompr, &uncomprLen, (Bytef*)response, contentLength);
	
	        if (err == Z_OK) {
	            delete [] response;
	            response = (char*)uncompr;
	            response[uncompressedContentLenght] = 0;
	        }
	        else if (err < 0) {
	            LOG.error("Error from zlib: %s", zError(err));
	            delete [] response;
	            response = NULL;
	            status = ERR_HTTP_INFLATE;
                    setError(
                        ERR_HTTP_INFLATE,
                        "ZLIB: error occurred decompressing data from Server.");
	            goto exit;
	        }
	    }
    }  //end if compression
#endif

    LOG.debug("Response read:\n%s", response);

exit:
    // Close the Internet handles.
    if (inet) {
        InternetCloseHandle (inet);
    }
    if (connection) {
        InternetCloseHandle (connection);
    }
    if (request) {
        InternetCloseHandle (request);
    }

    if ((status != STATUS_OK) && (response !=NULL)) {
        delete [] response; response = NULL;
    }
    if (wurlHost)     delete [] wurlHost;
    if (wurlResource) delete [] wurlResource;
    if (bufferA)      delete [] bufferA;

#ifdef USE_ZLIB
    if (compr)        delete [] compr;
    if (buffer)       delete [] buffer;
    if (wbuffer)      delete [] wbuffer;
#endif
    EXITING(L"TransportAgent::sendMessage");

    return response;
}


/**
 * Utility function to retrieve the correspondant message for the Wininet error code passed.
 * Pointer returned is allocated new, must be freed by caller.
 * @param errorCode  the code of the last error
 * @return           the error message for the passed code, new allocated buffer
 */
char* WinTransportAgent::createHttpErrorMessage(DWORD errorCode) {

    WCHAR* errorMessage = new WCHAR[512];
    memset(errorMessage, 0, 512);

    FormatMessage(
                FORMAT_MESSAGE_FROM_HMODULE,
                GetModuleHandle(L"wininet.dll"),
                errorCode,
                MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT),
                errorMessage,
                512,
                NULL);

    if (!errorMessage || wcslen(errorMessage) == 0) {
        wsprintf(errorMessage, L"Unknown error.");
    }

    char* ret = toMultibyte(errorMessage);
    if (errorMessage) delete [] errorMessage;
    return ret;
}


?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人性视频免费网站| 亚洲精品一二三四区| 国产日韩欧美不卡在线| 中文字幕+乱码+中文字幕一区| 国产精品久久夜| 亚洲午夜免费视频| 精品一区二区三区影院在线午夜| 国产制服丝袜一区| 色婷婷av久久久久久久| 日韩视频一区二区三区| 国产精品全国免费观看高清| 一区二区三区.www| 国内精品免费在线观看| 色婷婷久久久综合中文字幕| 欧美电视剧在线看免费| 亚洲欧美综合色| 欧美96一区二区免费视频| 成人av资源下载| 在线综合+亚洲+欧美中文字幕| 国产亚洲自拍一区| 亚洲最新在线观看| 国产精品69毛片高清亚洲| 欧美日韩一区精品| 国产欧美一区二区精品性色超碰| 亚洲一区二区成人在线观看| 国产精品乡下勾搭老头1| 欧美高清一级片在线| 欧美国产1区2区| 青青草国产精品97视觉盛宴| 99精品视频一区二区| 精品国产91洋老外米糕| 亚洲一区二区av在线| 99久久伊人网影院| 精品粉嫩aⅴ一区二区三区四区| 一区二区三区日韩欧美| 国产精品影视在线| 日韩一级在线观看| 亚洲国产精品视频| 日本国产一区二区| 欧美国产日韩一二三区| 免费不卡在线观看| 精品视频在线视频| 亚洲人精品一区| 成熟亚洲日本毛茸茸凸凹| 日韩三级av在线播放| 亚洲成人在线免费| 91女厕偷拍女厕偷拍高清| 国产欧美一区二区精品性色 | 豆国产96在线|亚洲| 日韩午夜激情电影| 三级在线观看一区二区| 在线观看亚洲精品| 亚洲色图视频免费播放| 国产成人av影院| ww久久中文字幕| 美国十次综合导航| 制服丝袜亚洲网站| 亚洲bt欧美bt精品777| 色拍拍在线精品视频8848| 国产精品午夜电影| 粉嫩一区二区三区性色av| 久久久久久久久久久久久女国产乱| 日本成人在线不卡视频| 欧美疯狂性受xxxxx喷水图片| 亚洲精品美腿丝袜| 色噜噜狠狠色综合中国| 亚洲女子a中天字幕| 91日韩一区二区三区| 亚洲美女视频在线观看| 91免费看`日韩一区二区| 最新高清无码专区| 色综合色综合色综合色综合色综合| 国产精品久久久久久久岛一牛影视 | 国产麻豆精品在线观看| 日韩精品一区二区三区在线| 免费成人在线视频观看| 欧美精品一区二区三区在线 | 国产欧美一区二区在线观看| 国产酒店精品激情| 久久久精品国产免费观看同学| 黄色日韩三级电影| 久久综合给合久久狠狠狠97色69| 精品影院一区二区久久久| 精品对白一区国产伦| 国产99久久久国产精品免费看| 国产日韩欧美高清| 99精品久久只有精品| 亚洲精品videosex极品| 欧美性受极品xxxx喷水| 天堂影院一区二区| 日韩亚洲欧美成人一区| 国产传媒一区在线| 国产精品电影院| 在线看日本不卡| 日韩黄色一级片| 精品国产乱子伦一区| 懂色av中文字幕一区二区三区| 国产精品久久久久一区| 欧洲av在线精品| 日韩中文字幕麻豆| 久久天天做天天爱综合色| a级精品国产片在线观看| 亚洲综合自拍偷拍| 91精品免费在线观看| 国产在线国偷精品免费看| 国产精品成人网| 欧美日韩一区国产| 国产精品资源网站| 18欧美乱大交hd1984| 欧美喷潮久久久xxxxx| 激情综合五月婷婷| 亚洲激情男女视频| 欧美电视剧在线观看完整版| 成人免费毛片片v| 亚洲va中文字幕| 久久影视一区二区| 色8久久人人97超碰香蕉987| 久久精品免费看| 综合久久久久综合| 欧美一级一区二区| 不卡在线观看av| 日本不卡不码高清免费观看| 国产欧美一区视频| 91精品国产综合久久久久| 国产成人在线色| 亚洲福利电影网| 欧美国产激情一区二区三区蜜月| 欧美三级在线播放| 国产suv精品一区二区三区| 亚洲午夜激情网站| 中文字幕精品三区| 欧美日韩国产小视频| 成人毛片在线观看| 蜜臀av亚洲一区中文字幕| 亚洲人成人一区二区在线观看| 日韩精品一区二区三区蜜臀 | 午夜不卡av在线| 国产精品三级视频| 日韩欧美一二区| 在线看不卡av| fc2成人免费人成在线观看播放| 日韩成人一级片| 亚洲精品美腿丝袜| 国产精品日韩成人| 精品国产精品网麻豆系列| 欧美日本在线看| 91免费在线看| 成人va在线观看| 国产精品综合av一区二区国产馆| 亚洲超碰精品一区二区| 亚洲伦理在线精品| 日本一区二区三区dvd视频在线| 制服丝袜中文字幕亚洲| 欧美最猛黑人xxxxx猛交| 成人动漫一区二区| 丁香婷婷综合色啪| 精品亚洲成a人在线观看| 午夜精品久久久久久久久久| 亚洲蜜臀av乱码久久精品| 国产精品亲子伦对白| 亚洲精品一区在线观看| 欧美一三区三区四区免费在线看| 91丨porny丨蝌蚪视频| 丁香一区二区三区| 国产成人精品网址| 国产一区二区三区四| 蜜臀av亚洲一区中文字幕| 人人精品人人爱| 午夜精品福利一区二区三区av| 亚洲三级免费电影| 一区在线观看免费| 中文字幕国产一区| 中文字幕欧美日韩一区| 久久精品人人做人人爽人人| 久久伊人中文字幕| 久久久.com| 国产片一区二区| 国产精品欧美一级免费| 国产欧美一区二区精品性色超碰 | 成人高清视频在线观看| 成人免费看的视频| 成人av在线资源网| 丁香天五香天堂综合| 国产成人自拍高清视频在线免费播放| 精品一区二区在线免费观看| 久久激情综合网| 国产一区美女在线| 国产一区不卡在线| 成人综合在线观看| 91免费观看在线| 欧美视频你懂的| 91精品国产综合久久精品性色| 欧美一区二区三区四区五区| 日韩你懂的在线观看| 欧美sm美女调教| 国产午夜亚洲精品羞羞网站| 欧美国产日本视频| 一区二区三区四区不卡在线| 亚洲成人综合网站| 另类欧美日韩国产在线|