1 : // Copyright 2014 Google Inc. All Rights Reserved.
2 : //
3 : // Licensed under the Apache License, Version 2.0 (the "License");
4 : // you may not use this file except in compliance with the License.
5 : // You may obtain a copy of the License at
6 : //
7 : // http://www.apache.org/licenses/LICENSE-2.0
8 : //
9 : // Unless required by applicable law or agreed to in writing, software
10 : // distributed under the License is distributed on an "AS IS" BASIS,
11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 : // See the License for the specific language governing permissions and
13 : // limitations under the License.
14 :
15 : #ifndef SYZYGY_KASKO_UPLOAD_H_
16 : #define SYZYGY_KASKO_UPLOAD_H_
17 :
18 : #include <stdint.h>
19 : #include <map>
20 : #include <string>
21 :
22 : #include "base/strings/string16.h"
23 :
24 m : namespace kasko {
25 :
26 m : class HttpAgent;
27 :
28 : // POSTs a multipart MIME message via HTTP(S).
29 : // @param agent The HTTP implementation to use.
30 : // @param url The resource to which to POST.
31 : // @param parameters HTTP request parameters to be encoded in the body.
32 : // @param upload_file File contents to be encoded in the body.
33 : // @param file_part_name The parameter name to be assigned to the file part.
34 : // @param response_body Receives the HTTP response body.
35 : // @param response_code Receives the HTTP response status code.
36 : // @returns true if successful.
37 m : bool SendHttpUpload(HttpAgent* agent,
38 m : const base::string16& url,
39 m : const std::map<base::string16, base::string16>& parameters,
40 m : const std::string& upload_file,
41 m : const base::string16& file_part_name,
42 m : base::string16* response_body,
43 m : uint16_t* response_code);
44 :
45 m : } // namespace kasko
46 :
47 : #endif // SYZYGY_KASKO_UPLOAD_H_
|