equal
deleted
inserted
replaced
1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
13 // Description: |
13 // Description: |
14 // |
14 // |
15 |
15 |
16 #include "chttpservice.h" |
16 #include "chttpservice.h" |
17 #include "httpclientutils.h" |
17 #include "httpclientutils.h" |
18 |
18 #include "chttpclientauthentication.h" |
|
19 #include "mhttpserviceauthentication.h" |
|
20 #include "chttpnetworkconnectioninfo.h" |
19 const TInt KMaxNoOfConnections = 6; |
21 const TInt KMaxNoOfConnections = 6; |
20 const TInt KMaxTransToPipeline = 5; |
22 const TInt KMaxTransToPipeline = 5; |
21 |
23 |
22 /** |
24 /** |
23 * The default 2-phase constructor to create a CHttpService instance |
25 * The default 2-phase constructor to create a CHttpService instance |
41 { |
43 { |
42 iHttpServiceStruct->iHttpSession.Close(); |
44 iHttpServiceStruct->iHttpSession.Close(); |
43 } |
45 } |
44 delete iHttpServiceStruct; |
46 delete iHttpServiceStruct; |
45 } |
47 } |
|
48 |
|
49 /** |
|
50 * Destructor of the inner class CHttpServiceStruct |
|
51 */ |
|
52 CHttpService::CHttpServiceStruct::~CHttpServiceStruct() |
|
53 { |
|
54 delete iHttpClientAuthentication; |
|
55 } |
46 |
56 |
47 /** |
57 /** |
48 * Retrieves the equivalent string for a give string ID from the |
58 * Retrieves the equivalent string for a give string ID from the |
49 * HTTP string pool |
59 * HTTP string pool |
50 * |
60 * |
210 TInt err = iHttpServiceStruct->iSessionHeaders.SetRawField(str, aHeaderValue, KFieldSeparator); |
220 TInt err = iHttpServiceStruct->iSessionHeaders.SetRawField(str, aHeaderValue, KFieldSeparator); |
211 str.Close(); |
221 str.Close(); |
212 return err; |
222 return err; |
213 } |
223 } |
214 |
224 |
|
225 EXPORT_C TInt CHttpService::SetAuthentication(MHTTPServiceAuthentication* aCallback) |
|
226 { |
|
227 TInt error = KErrGeneral; |
|
228 iHttpServiceStruct->iHttpClientAuthentication = CHttpClientAuthentication::New(iHttpServiceStruct->iHttpSession, aCallback); |
|
229 if(iHttpServiceStruct->iHttpClientAuthentication) |
|
230 error = KErrNone; |
|
231 return error; |
|
232 } |
|
233 |
215 /** |
234 /** |
216 * Constructor |
235 * Constructor |
217 */ |
236 */ |
218 CHttpService::CHttpService() |
237 CHttpService::CHttpService() |
219 : iHttpServiceStruct(NULL) |
238 : iHttpServiceStruct(NULL) |
227 iHttpServiceStruct->iSessionHeaders = iHttpServiceStruct->iHttpSession.RequestSessionHeadersL(); |
246 iHttpServiceStruct->iSessionHeaders = iHttpServiceStruct->iHttpSession.RequestSessionHeadersL(); |
228 SetMaxConnections(KMaxNoOfConnections); |
247 SetMaxConnections(KMaxNoOfConnections); |
229 SetMaxTransactionsToPipeline(KMaxTransToPipeline); |
248 SetMaxTransactionsToPipeline(KMaxTransToPipeline); |
230 } |
249 } |
231 |
250 |
|
251 EXPORT_C CHttpNetworkConnection* CHttpService::HttpNetworkConnection() |
|
252 { |
|
253 CHttpNetworkConnection *httpNetworkConn = CHttpNetworkConnection::New(); |
|
254 httpNetworkConn->SetHttpService(this); |
|
255 return httpNetworkConn; |
|
256 } |