|
1 /* |
|
2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: CXcapHttpResponse |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __XCAPHTTPRESPONSE__ |
|
22 #define __XCAPHTTPRESPONSE__ |
|
23 |
|
24 // INCLUDES |
|
25 #include <http.h> |
|
26 #include "XcapHttpConsts.h" |
|
27 |
|
28 //FORWARD DECLARATIONs |
|
29 class CXcapHttpRequest; |
|
30 class CXcapHttpAuthManager; |
|
31 |
|
32 // CLASS DECLARATION |
|
33 NONSHARABLE_CLASS( CXcapHttpResponse ) : public CBase, |
|
34 public MHTTPTransactionCallback |
|
35 { |
|
36 public: // Constructors and destructor |
|
37 |
|
38 /** |
|
39 * A global logging function for 16 bit data. |
|
40 * @param aCommand command to be handled |
|
41 */ |
|
42 static CXcapHttpResponse* CXcapHttpResponse::NewL( CXcapHttpRequest* aHttpRequest, |
|
43 CXcapHttpTransport& aTransportMain ); |
|
44 |
|
45 /** |
|
46 * Destructor. |
|
47 */ |
|
48 virtual ~CXcapHttpResponse(); |
|
49 |
|
50 public: //New functions |
|
51 |
|
52 /** |
|
53 * Stores the address of the proxy currently in use |
|
54 * @param aProxy Address of the HTTP proxy server |
|
55 */ |
|
56 TInt ContentLengthL() const; |
|
57 |
|
58 private: |
|
59 |
|
60 /** |
|
61 * A global logging function for 16 bit data. |
|
62 * @param aCommand command to be handled |
|
63 */ |
|
64 CXcapHttpResponse( CXcapHttpRequest* aHttpRequest, |
|
65 CXcapHttpTransport& aTransportMain ); |
|
66 |
|
67 /** |
|
68 * A global logging function for 16 bit data. |
|
69 * @param aCommand command to be handled |
|
70 */ |
|
71 void ConstructL(); |
|
72 |
|
73 /** |
|
74 * Stores the address of the proxy currently in use |
|
75 * @param aProxy Address of the HTTP proxy server |
|
76 */ |
|
77 RHTTPHeaders ResponseHeaderCollection() const; |
|
78 |
|
79 /** |
|
80 * Stores the address of the proxy currently in use |
|
81 * @param aProxy Address of the HTTP proxy server |
|
82 */ |
|
83 RHTTPHeaders RequestHeaderCollection() const; |
|
84 |
|
85 /** |
|
86 * Stores the address of the proxy currently in use |
|
87 * @param aProxy Address of the HTTP proxy server |
|
88 */ |
|
89 TBool HandleReceivedBodyDataL( const RHTTPTransaction aTransaction ); |
|
90 |
|
91 /** |
|
92 * Stores the address of the proxy currently in use |
|
93 * @param aProxy Address of the HTTP proxy server |
|
94 */ |
|
95 TBool IsUnauthRequest( RHTTPTransaction aTransaction, TInt& aAuthType ); |
|
96 |
|
97 /** |
|
98 * Stores the address of the proxy currently in use |
|
99 * @param aProxy Address of the HTTP proxy server |
|
100 */ |
|
101 TBool ParseAuthInfoParam( TInt& aLength, TAuthInfoParam& aName, |
|
102 TPtrC8& aValue, TPtr8& aParam ); |
|
103 |
|
104 /** |
|
105 * Stores the address of the proxy currently in use |
|
106 * @param aProxy Address of the HTTP proxy server |
|
107 */ |
|
108 TBool CheckAuthInfoHeaderL( RHTTPHeaders aHeaders ); |
|
109 |
|
110 #ifdef _DEBUG |
|
111 |
|
112 /** |
|
113 * Convert undefined HTTP stack errors |
|
114 */ |
|
115 void DumpHeadersL( RHTTPHeaders aHeaders, TInt aId ); |
|
116 |
|
117 #endif |
|
118 |
|
119 private: //From MHTTPTransactionCallback |
|
120 |
|
121 /** |
|
122 * Handles all responses |
|
123 * coming from the remote host |
|
124 * @param aTransaction The finished transaction |
|
125 * @param aEvent Type of the event |
|
126 */ |
|
127 void MHFRunL( RHTTPTransaction aTransaction, const THTTPEvent& aEvent ); |
|
128 |
|
129 /** |
|
130 * From MHTTPTransactionCallback, called when the RunL() of a transaction leaves |
|
131 * @param aInt The error the HTTP framework left with |
|
132 * @param aTransaction The failed transaction |
|
133 * @param aEvent The event that was being processed |
|
134 * @return KErrNone (HTTP framework panics if client returns any other error) |
|
135 */ |
|
136 TInt MHFRunError( TInt aInt, RHTTPTransaction aTransaction, const THTTPEvent& aEvent ); |
|
137 |
|
138 private: //Data |
|
139 |
|
140 TBool iAuthPending; |
|
141 CXcapHttpRequest* iHttpRequest; |
|
142 CXcapHttpTransport& iTransportMain; |
|
143 CXcapHttpAuthManager& iAuthManager; |
|
144 TInt iUnauthRequestCounter; |
|
145 }; |
|
146 |
|
147 |
|
148 #endif |
|
149 |
|
150 // End of File |