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". |
18 |
18 |
19 #include <e32std.h> |
19 #include <e32std.h> |
20 #include <http.h> |
20 #include <http.h> |
21 #include <in_sock.h> |
21 #include <in_sock.h> |
22 #include "httpheaderiter.h" |
22 #include "httpheaderiter.h" |
23 |
23 class CHttpNetworkConnection; |
24 /** |
24 /** |
25 * CHttpService represent a handle to the HTTP service instance for a set of client |
25 * CHttpService represent a handle to the HTTP service instance for a set of client |
26 * HTTP transactions[a request and its equivalent response]. The application can |
26 * HTTP transactions[a request and its equivalent response]. The application can |
27 * specify connection preferences[proxy, max. no of connections allowed in a single |
27 * specify connection preferences[proxy, max. no of connections allowed in a single |
28 * HTTP service instance], pipelining, setting request headers that applies to all |
28 * HTTP service instance], pipelining, setting request headers that applies to all |
29 * transactions that the CHttpService holds etc... |
29 * transactions that the CHttpService holds etc... |
30 * |
30 * |
31 * @publishedAll |
31 * @publishedAll |
32 * @prototype |
32 * @prototype |
33 */ |
33 */ |
34 |
34 class CHttpClientAuthentication; |
|
35 class MHTTPServiceAuthentication; |
35 class CHttpService : public CBase |
36 class CHttpService : public CBase |
36 { |
37 { |
37 friend class CHttpClientTransactionImpl; |
38 friend class CHttpClientTransactionImpl; |
|
39 friend class CHttpNetworkConnection; |
38 public: |
40 public: |
39 |
41 |
40 IMPORT_C static CHttpService* NewL(); |
42 IMPORT_C static CHttpService* NewL(); |
41 IMPORT_C ~CHttpService(); |
43 IMPORT_C ~CHttpService(); |
42 |
44 |
52 IMPORT_C TInt MaxTransactionsToPipeline() const; |
54 IMPORT_C TInt MaxTransactionsToPipeline() const; |
53 |
55 |
54 IMPORT_C TInt AddRequestHeader(TInt aHeaderId, const THttpHeaderValueVariant& aHeaderValue); |
56 IMPORT_C TInt AddRequestHeader(TInt aHeaderId, const THttpHeaderValueVariant& aHeaderValue); |
55 IMPORT_C TInt AddCustomRequestHeader(const TDesC8& aHeaderName, const TDesC8& aHeaderValue); |
57 IMPORT_C TInt AddCustomRequestHeader(const TDesC8& aHeaderName, const TDesC8& aHeaderValue); |
56 |
58 |
|
59 IMPORT_C TInt SetAuthentication(MHTTPServiceAuthentication* aCallback); |
|
60 |
|
61 IMPORT_C CHttpNetworkConnection* HttpNetworkConnection(); |
57 |
62 |
58 private: |
63 private: |
59 CHttpService(); |
64 CHttpService(); |
60 void ConstructL(); |
65 void ConstructL(); |
61 |
66 |
62 class CHttpServiceStruct : public CBase |
67 NONSHARABLE_CLASS(CHttpServiceStruct) : public CBase |
63 { |
68 { |
64 public: |
69 public: |
65 RHTTPSession iHttpSession; |
70 ~CHttpServiceStruct(); |
66 RHTTPHeaders iSessionHeaders; |
71 RHTTPSession iHttpSession; |
|
72 RHTTPHeaders iSessionHeaders; |
|
73 CHttpClientAuthentication* iHttpClientAuthentication; |
67 }; |
74 }; |
68 private: |
75 private: |
69 RHTTPSession Session() |
76 RHTTPSession Session() |
70 { |
77 { |
71 return iHttpServiceStruct->iHttpSession; |
78 return iHttpServiceStruct->iHttpSession; |
72 } |
79 } |
73 private: |
80 private: |
74 |
81 |
75 |
82 |
76 CHttpServiceStruct* iHttpServiceStruct; // Implementation struct |
83 CHttpServiceStruct* iHttpServiceStruct; // Implementation struct |
77 }; |
84 }; |
78 |
85 |
79 #endif // __CHTTPSERVICE_H__ |
86 #endif // __CHTTPSERVICE_H__ |