|
1 /* |
|
2 * Copyright (c) 1999 - 2001 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 the License "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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef NW_LOADREQ_H |
|
20 #define NW_LOADREQ_H |
|
21 |
|
22 /* |
|
23 ** Includes |
|
24 */ |
|
25 #include "nwx_defs.h" |
|
26 |
|
27 #include "nw_nvpair.h" |
|
28 #include "nwx_buffer.h" |
|
29 #include "nwx_http_header.h" |
|
30 #include "urlloader_urlresponse.h" |
|
31 #include "nw_hed_appservices.h" |
|
32 #include "BrsrStatusCodes.h" |
|
33 /* |
|
34 ** Type Declarations |
|
35 */ |
|
36 |
|
37 /* |
|
38 ** Preprocessor Macro Definitions |
|
39 */ |
|
40 |
|
41 |
|
42 #ifdef __cplusplus |
|
43 extern "C" { |
|
44 #endif |
|
45 |
|
46 /* |
|
47 ** Global Function Declarations |
|
48 */ |
|
49 |
|
50 /***************************************************************** |
|
51 |
|
52 Name: NW_LoadReq_Create |
|
53 |
|
54 Description: |
|
55 Create loader data structures for an Http load request. |
|
56 Helper routine to create request for the loaders. |
|
57 |
|
58 Parameters: |
|
59 url - in: url to load. |
|
60 postMethodFlag - in: flag indicating HTTP POST method or not. |
|
61 referer - in: referer to the url. |
|
62 acceptCharset - in: character set gateway will accept. |
|
63 postfields - in: postdata name/value pairs. |
|
64 Note: Not const because have to change to iterate over. |
|
65 enctype - in: urlencoded or multipart/form-data. |
|
66 docCharset - in: charset encoding for document. |
|
67 header - in/out: if empty (NULL) a new header is created. |
|
68 if not empty, a copy is made and added to. |
|
69 resultUrl - out: url created for request |
|
70 method - out: post or get. |
|
71 body - out: body for load request. |
|
72 appServices ? |
|
73 appCtx ? |
|
74 |
|
75 Return Value: KBrsrSuccess |
|
76 KBrsrFailure |
|
77 KBrsrUnsupportedFormCharset |
|
78 KBrsrOutOfMemory |
|
79 |
|
80 Notes: |
|
81 cacheMode not needed for this helper function. |
|
82 |
|
83 ******************************************************************/ |
|
84 TBrowserStatusCode NW_LoadReq_Create ( const NW_Ucs2 *url, |
|
85 const NW_Bool postMethodFlag, |
|
86 const NW_Ucs2 *referer, |
|
87 const NW_Ucs2 *acceptCharset, |
|
88 NW_NVPair_t *postfields, /* Can't be const. */ |
|
89 const NW_Ucs2 *enctype, |
|
90 const NW_Http_CharSet_t docCharset, |
|
91 NW_Http_Header_t **header, /* Start output params */ |
|
92 NW_Ucs2 **resultUrl, |
|
93 NW_Uint8 *method, |
|
94 NW_Buffer_t **body, |
|
95 NW_HED_AppServices_t * appServices, |
|
96 void * appCtx); |
|
97 |
|
98 |
|
99 /************************************************************************ |
|
100 |
|
101 Function: NW_LoadReq_BuildQuery |
|
102 |
|
103 Description: Construct a query from the url and escaped_postdata, |
|
104 and places the result in *query. It is the caller's |
|
105 responsibility to delete the resulting string. |
|
106 |
|
107 If the number of postfields is 0, the query is just a |
|
108 new copy the original url. This prevents us from |
|
109 appending a lone '?' at the end of a 'canned' query |
|
110 url like |
|
111 |
|
112 "http://waplabdc/foo.wml?name=bar;value=foo" |
|
113 |
|
114 Parameters: url - in: pointer to the URL |
|
115 postfields - in: pointer to the postfield data |
|
116 resultUrl - out: constructed result URL. |
|
117 appServices ? |
|
118 appCtx ? |
|
119 |
|
120 Return Value: KBrsrSuccess |
|
121 KBrsrFailure |
|
122 KBrsrOutOfMemory |
|
123 |
|
124 **************************************************************************/ |
|
125 TBrowserStatusCode NW_LoadReq_BuildQuery(const NW_Ucs2 *url, |
|
126 NW_NVPair_t *postfields, |
|
127 NW_Ucs2 **resultUrl, |
|
128 NW_HED_AppServices_t * appServices, |
|
129 void * appCtx); |
|
130 |
|
131 /** |
|
132 * Checks the encoding type to see if it is for a multipart request. |
|
133 * @since 2.5 |
|
134 * @param aEncodingType Ptr to encoding type string to be checked. |
|
135 * @return NW_TRUE if multipart. |
|
136 * NW_FALSE if not multipart. |
|
137 */ |
|
138 NW_Bool NW_LoadReq_IsMultipart( const NW_Ucs2* aEncodingType ); |
|
139 |
|
140 /** |
|
141 * Determines whether or not the current part of the multipart post is for a |
|
142 * file to be uploaded or not. |
|
143 * @param aValue Ptr to value of the variable. |
|
144 * @return NW_TRUE if the part is for file to be uploaded. |
|
145 * NW_FALSE if not a file. |
|
146 */ |
|
147 NW_Bool NW_LoadReq_IsUploadFile( const NW_Ucs2 *aValue ); |
|
148 |
|
149 |
|
150 #ifdef __cplusplus |
|
151 } /* extern "C" */ |
|
152 #endif |
|
153 |
|
154 #endif /* NW_NVPAIR_H */ |
|
155 |
|
156 |