|
1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __CHTTPCLIENTHANDLER_H__ |
|
17 #define __CHTTPCLIENTHANDLER_H__ |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <http/framework/cprotocolhandler.h> |
|
21 #include <http/framework/mrxdataobserver.h> |
|
22 #include <http/framework/logging.h> |
|
23 |
|
24 #include "mconnectionprefsprovider.h" |
|
25 #include "mhttpbatchingpropertiescallback.h" |
|
26 #include "timerlogger.h" |
|
27 |
|
28 class CHttpTransportLayer; |
|
29 class CHttpConnectionInfo; |
|
30 class CHttpConnectionManager; |
|
31 class CX509Certificate; |
|
32 class CX500DistinguishedName; |
|
33 class TCertInfo; |
|
34 class TDNInfo; |
|
35 class CHttpPipelineFallback; |
|
36 |
|
37 class CHttpClientHandler : public CProtocolHandler, |
|
38 public MConnectionPrefsProvider, |
|
39 public MRxDataObserver, |
|
40 public MHttpBatchingPropertiesCallback, |
|
41 public MProtHandlerInterface |
|
42 |
|
43 { |
|
44 public: |
|
45 |
|
46 static CHttpClientHandler* NewL(TAny* aSession); |
|
47 virtual ~CHttpClientHandler(); |
|
48 |
|
49 private: // methods from CProtocolHandler |
|
50 virtual void MHFRunL(RHTTPTransaction aTransaction, const THTTPEvent& aEvent); |
|
51 virtual TInt SessionServerCert(TCertInfo& aServerCert); |
|
52 virtual TInt TransactionServerCert(TCertInfo& aServerCert, RHTTPTransaction aTransaction); |
|
53 virtual void CreateCodecL(); |
|
54 virtual CProtTransaction* CreateProtTransactionL(RHTTPTransaction aTransaction) ; |
|
55 virtual TBool ServiceL(CProtTransaction& aTrans); |
|
56 virtual void ClosedTransactionHook(CProtTransaction* aTrans); |
|
57 virtual void CancelTransactionHook(CProtTransaction& aTransaction); |
|
58 virtual void NotifyNewRequestBodyPart(CProtTransaction& aTransaction); |
|
59 virtual void GetInterfaceL(TUid aInterfaceId, MProtHandlerInterface*& aInterfacePtr); |
|
60 |
|
61 private: // methods from MConnectionPrefsProvider |
|
62 |
|
63 virtual TBool SupplyCommsConnection( RConnection*& aConnectionPtr ); |
|
64 virtual TBool SupplySocketServerHandle ( TInt& aSocketServerHandle ); |
|
65 virtual void SetCommsConnectionL( RConnection* aConnectionPtr ); |
|
66 virtual void SetSocketServerHandleL ( TInt aSocketServerHandle ); |
|
67 virtual void GetSecurityPrefs( TBool& aDialogPrompt, MSecurityPolicy*& aSecurityPolicy ); |
|
68 virtual TBool ImmediateSocketShutdown(); |
|
69 virtual TInt SessionId(); |
|
70 virtual TInt GetRecvBufferSize(); |
|
71 |
|
72 private: // methods from MRxDataObserver |
|
73 |
|
74 virtual void SetStatusL(CRxData& aRxData, TInt aStatus); |
|
75 |
|
76 private: // methods from MHttpBatchingPropertiesCallback |
|
77 |
|
78 virtual TInt GetMaxBatchingBufferSize(); |
|
79 |
|
80 private: // methods from MProtHandlerInterface |
|
81 |
|
82 virtual const CCertificate* TransactionServerCert(RHTTPTransaction aTransaction); |
|
83 virtual const CCertificate* SessionServerCert(); |
|
84 |
|
85 private: |
|
86 |
|
87 CHttpClientHandler(RHTTPSession aSession); |
|
88 void ConstructL(); |
|
89 |
|
90 CHttpConnectionInfo* PrepareTransactionL(RHTTPTransaction aTrans, TBool& aNeedTunnel, TBool& aCanPipeline); |
|
91 void CreateRequestUriL(TInt aMethodIndex, RHTTPTransaction aTrans, TPtrC8& aHost, TInt& aPort); |
|
92 TBool SetHostHeaderL(RHTTPTransaction aTrans, const TDesC8& aHost, TInt aPort); |
|
93 void AddTunnelInfoL(RHTTPTransaction aTrans, const TDesC8& aHost, TInt aPort); |
|
94 TBool SelectConnectionManagerL(const CHttpConnectionInfo& aConnectionInfo, RHTTPTransaction aTrans, TBool aCanPipeline, CHttpConnectionManager *&aManager); |
|
95 CHttpConnectionManager* SelectTunnelConnectionL(const CHttpConnectionInfo& aConnectionInfo, RHTTPTransaction aTrans, TBool aCanPipeline); |
|
96 TInt MaxNumConnectionManagers() const; |
|
97 void SetupProxyInformation(RHTTPTransaction aTrans); |
|
98 TBool CheckPipelineSupport(RHTTPTransaction aTrans); |
|
99 |
|
100 void GetCipherSuiteL(RHTTPTransaction aTransaction); |
|
101 |
|
102 TInt MaxNumTransactionsToPipeline() const; |
|
103 |
|
104 void __RecordConnectionManagerCreationL(); |
|
105 void EnsureStrictConnectMethodHeaders(RHTTPTransaction aTransaction); |
|
106 TInt SetStatus(CRxData& aRxData, TInt aStatus); |
|
107 |
|
108 #if defined (_DEBUG) |
|
109 TInt GetConnectionID(const CHttpConnectionManager* aConnectionManager); |
|
110 TInt GetConnectionID(const RHTTPTransaction &aTrans); |
|
111 #endif |
|
112 |
|
113 static void GetCertInfoL(const CX509Certificate& aSource, TCertInfo& aDest); |
|
114 static void GetDNInfo(const CX500DistinguishedName& aSource, TDNInfo& aDest); |
|
115 |
|
116 private: |
|
117 TBool iEnableOptimalPipeline; |
|
118 TBool iUseProxy; |
|
119 TInt iRecvBufferSize; |
|
120 mutable TInt iMaxNumConnectionManagers; |
|
121 mutable TInt iMaxNumTransactionsToPipeline; |
|
122 CHttpTransportLayer* iTransportLayer; |
|
123 CHttpPipelineFallback* iPipelineFallback; |
|
124 TBool* iSessionClosingPtr; // Not owned, set in ConstructL |
|
125 const TStringTable& iStringTable; |
|
126 RStringF iProxyAddress; |
|
127 RPointerArray<CHttpConnectionManager> iConnectionManagers; |
|
128 __FLOG_DECLARATION_MEMBER2 |
|
129 |
|
130 }; |
|
131 |
|
132 #endif // __CHTTPCLIENTHANDLER_H__ |
|
133 |