void vmsUrlMonRequestCollector::onHttpNegotiate_OnResponse(IHttpNegotiate* pHN, DWORD dwResponseCode, LPCWSTR szResponseHeaders, LPCWSTR szRequestHeaders, LPWSTR* pszAdditionalRequestHeaders)
{
	vmsCriticalSectionAutoLock csal (&m_csReq);
	int nIndex = findRequestIndexByHttpNegotiate (pHN);
	if (nIndex == -1)
		return;
	Request *req = getRequest (nIndex);
	req->dwState |= Request::GotResponse;

	IWinInetHttpInfoPtr spWinInetHttpInfo (req->spProt);
	if (spWinInetHttpInfo != NULL)
	{
		DWORD dwSize = 0, dwFlags = 0;
		spWinInetHttpInfo->QueryInfo (HTTP_QUERY_RAW_HEADERS_CRLF | HTTP_QUERY_FLAG_REQUEST_HEADERS, 0, &dwSize, &dwFlags, 0);
		if (dwSize)
		{
			std::vector <char> vBuf (dwSize);
			LPSTR psz = &vBuf.front (); *psz = 0;
			spWinInetHttpInfo->QueryInfo (HTTP_QUERY_RAW_HEADERS_CRLF | HTTP_QUERY_FLAG_REQUEST_HEADERS, psz, &dwSize, &dwFlags, 0);
			req->strRequestHeaders = psz;
		}
		dwSize = 0; dwFlags = 0;
		spWinInetHttpInfo->QueryInfo (HTTP_QUERY_RAW_HEADERS_CRLF, 0, &dwSize, &dwFlags, 0);
		if (dwSize)
		{
			std::vector <char> vBuf (dwSize);
			LPSTR psz = &vBuf.front (); *psz = 0;
			spWinInetHttpInfo->QueryInfo (HTTP_QUERY_RAW_HEADERS_CRLF, psz, &dwSize, &dwFlags, 0);
			req->strResponseHeaders = psz;
		}
	}

	IWinInetInfoPtr spWinInetInfo (req->spProt);
	if (spWinInetInfo != NULL)
	{
		vector <char> vch; vch.resize (1000); vch [0] = 0;
		DWORD dwSize = vch.size ();
		HRESULT hr = spWinInetInfo->QueryOption (INTERNET_OPTION_URL, &vch[0], &dwSize);
		if (dwSize > vch.size ())
		{
			vch.resize (dwSize); vch [0] = 0;
			hr = spWinInetInfo->QueryOption (INTERNET_OPTION_URL, &vch[0], &dwSize);
		}
		if (SUCCEEDED (hr))
		{
			USES_CONVERSION;
			wstring wstr = A2CW (&vch[0]);
			if (wcscmp (wstr.c_str (), req->wstrUrl.c_str ()))
				req->wstrRedirectedUrl = wstr;
		}
	}
}
// -----------------------------------------------------------------------------
// CTestPlatAlfVisual::TestAlfCtrlProcessVisualL
// -----------------------------------------------------------------------------
//
TInt CTestPlatAlfVisual::TestAlfCtrlProcessVisualL( CStifItemParser& /*aItem*/ )
    {
    _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
    _LIT( KTestAlfCtrlProcessVisualL, "TestAlfCtrlProcessVisualL" );
    TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfCtrlProcessVisualL );
    // Print to log file
    iLog->Log( KTestAlfCtrlProcessVisualL );
    CAlfVisual* vVisual = new ( ELeave ) CAlfVisual();
    CleanupStack::PushL( vVisual );
    vVisual->ConstructL( *iAlfCtl );
    TInt err = iAlfCtl->Append( vVisual );
    if ( err != KErrNone )
        {
        CleanupStack::PopAndDestroy( vVisual );
        return err;
        }
    CleanupStack::Pop( vVisual );
    TBuf8<KBufSize> vBuf(KVisualTag);
    vVisual->SetTagL( vBuf );
    STIF_ASSERT_EQUALS( 1, iAlfCtl->VisualCount() );
    STIF_ASSERT_NOT_NULL( iAlfCtl->FindTag( vBuf ) );
    STIF_ASSERT_SAME( vVisual, &( iAlfCtl->Visual( 0 ) ) );
    
    iAlfCtl->VisualLayoutUpdated( *vVisual );
    iAlfCtl->VisualPrepareDrawFailed( *vVisual, -1 );
    iAlfCtl->VisualDestroyed( *vVisual );
    
    iAlfCtl->Remove( vVisual );
    STIF_ASSERT_EQUALS( 0, iAlfCtl->VisualCount() );
    iAlfCtl->AppendVisualL( EAlfVisualTypeText );
    
    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestPlatAlfVisual::TestAlfGenComponentProcessL
// -----------------------------------------------------------------------------
//
TInt CTestPlatAlfVisual::TestAlfGenComponentProcessL( CStifItemParser& /*aItem*/ )
    {
    _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
    _LIT( KTestAlfGenComponentProcessL, "TestAlfGenComponentProcessL" );
    TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfGenComponentProcessL );
    // Print to log file
    iLog->Log( KTestAlfGenComponentProcessL );
    _LIT8( KTest, "test" );
    TBuf8<KBufSize> vBuf( KTest );
    CAlfGenComponent* vComponent = CAlfGenComponent::NewL( *iAlfEnv, 0, 0x0DDDDDDE,
            vBuf );
    CleanupStack::PushL( vComponent );
    vComponent->Identifier();
    _LIT8( KInput, "in" );
    TBuf8<KBufSize> vInputBuf( KInput );
    _LIT8( KOut, "out" );
    TBuf8<KBufSize> vOutBuf( KOut );
    vComponent->DoSynchronousCmd( 0, vInputBuf, vOutBuf );
    vComponent->CancelAsynchCmd( 0 );
    vComponent->DoAsynchronousCmdL( 0, vInputBuf, vOutBuf, NULL );
    vComponent->DoCmdNoReply( 0 , vInputBuf );
    
    CleanupStack::PopAndDestroy( vComponent );
    
    return KErrNone;
    }
示例#4
0
int ttyHandler::writeToTTY(std::string strWrite) {
	std::vector<unsigned char> vBuf(strWrite.begin(), strWrite.end());
	if(vBuf.back() != '\n')
	{
		vBuf.push_back('\n');
	}
	int nRet = m_sh.write_serial_port((void*)&vBuf[0], vBuf.size());
	return nRet;
}
// -----------------------------------------------------------------------------
// CTestPlatAlfVisual::TestAlfGenComponentNewL
// -----------------------------------------------------------------------------
//
TInt CTestPlatAlfVisual::TestAlfGenComponentNewL( CStifItemParser& /*aItem*/ )
    {
    _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
    _LIT( KTestAlfGenComponentNewL, "TestAlfGenComponentNewL" );
    TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfGenComponentNewL );
    // Print to log file
    iLog->Log( KTestAlfGenComponentNewL );
    _LIT8( KTest, "test" );
    TBuf8<KBufSize> vBuf( KTest );
    CAlfGenComponent* vComponent = CAlfGenComponent::NewL( *iAlfEnv, 0, 0x0DDDDDDE,
            vBuf );
    CleanupStack::PushL( vComponent );
    STIF_ASSERT_NOT_NULL( vComponent );
    CleanupStack::PopAndDestroy( vComponent );
    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestPlatAlfVisual::TestAlfDeckLayoutForVisualL
// -----------------------------------------------------------------------------
//
TInt CTestPlatAlfVisual::TestAlfDeckLayoutForVisualL( CStifItemParser& /*aItem*/ )
    {
    _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
    _LIT( KTestAlfDeckLayoutForVisualL, "TestAlfDeckLayoutForVisualL" );
    TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfDeckLayoutForVisualL );
    // Print to log file
    iLog->Log( KTestAlfDeckLayoutForVisualL );
    
    CAlfDeckLayout* vLayout = CAlfDeckLayout::AddNewL( *iAlfCtl );
    _LIT8( KTest, "tset" );
    TBuf8<KBufSize> vBuf( KTest );
    vLayout->FindTag( vBuf );
    vLayout->UpdateChildrenLayout();
    vLayout->RemoveAndDestroyAllD();
    
    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestPlatAlfVisual::TestAlfLayoutForVisualL
// -----------------------------------------------------------------------------
//
TInt CTestPlatAlfVisual::TestAlfLayoutForVisualL( CStifItemParser& /*aItem*/ )
    {
    _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
    _LIT( KTestAlfLayoutForVisualL, "TestAlfLayoutForVisualL" );
    TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfLayoutForVisualL );
    // Print to log file
    iLog->Log( KTestAlfLayoutForVisualL );
    
    CAlfLayout* vLayout = CAlfLayout::AddNewL( *iAlfCtl );
    CAlfImageVisual* vVisualOne = CAlfImageVisual::AddNewL( *iAlfCtl );
    TUid vUid = { 0x00000000 };
    TAlfImage vFirstImage( vUid, EAknsAppIconTypeList, 
            TSize( 1, 1), EAspectRatioPreserved, 0, 0, 0, 0 );
    vVisualOne->SetImage( vFirstImage );
    
    CAlfImageVisual* vVisualTwo = CAlfImageVisual::AddNewL( *iAlfCtl );
    TUid vSecUid = { 0x00000001 };
    TAlfImage vSecImage( vSecUid, EAknsAppIconTypeList, 
            TSize( 1, 1), EAspectRatioPreserved, 0, 0, 0, 0 );
    vVisualTwo->SetImage( vSecImage );
    vLayout->Append( vVisualOne );
    vLayout->Remove( vVisualOne );
    vLayout->Append( vVisualOne );
    vLayout->Append( vVisualTwo );
    vLayout->Reorder( *vVisualOne, 0 );
    vLayout->MoveVisualToFront( *vVisualTwo );
    vLayout->MoveVisualToBack( *vVisualTwo );
//    vLayout->VirtualSize();//error
    vLayout->FindVisual( vVisualOne );
    vLayout->Remove( vVisualOne );
    vLayout->Insert( vVisualOne, 0 );
    vLayout->Count();
    vLayout->Visual( 1 );
    _LIT8( KTest, "tset" );
    TBuf8<KBufSize> vBuf( KTest );
    vLayout->FindTag( vBuf );
    vLayout->UpdateChildrenLayout();
    vLayout->RemoveAndDestroyAllD();
    
    return KErrNone;
    }