bes  Updated for version 3.20.6
httpd_catalog_module/curl_utils.h
1 // -*- mode: c++; c-basic-offset:4 -*-
2 
3 // This file is part of BES httpd_catalog_module, A C++ module that can be loaded in to
4 // the OPeNDAP Back-End Server (BES) and is able to handle remote requests.
5 
6 // Copyright (c) 2018 OPeNDAP, Inc.
7 // Author: Nathan Potter <ndp@opendap.org>
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU Lesser General Public
11 // License as published by the Free Software Foundation; either
12 // version 2.1 of the License, or (at your option) any later version.
13 //
14 // This library is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 // Lesser General Public License for more details.
18 //
19 // You should have received a copy of the GNU Lesser General Public
20 // License along with this library; if not, write to the Free Software
21 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 //
23 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
24 
25 // Please read the full copyright statement in the file COPYRIGHT_URI.
26 //
27 // Authors:
28 // ndp Nathan Potter <ndp@opendap.org>
29 
30 #ifndef I_HTTPD_CURL_UTILS_H_
31 #define I_HTTPD_CURL_UTILS_H_
32 
33 #include <string>
34 #include <vector>
35 
36 #include <curl/curl.h>
37 #include <curl/easy.h>
38 
39 namespace httpd_catalog {
40 
41 CURL *init(char *error_buffer);
42 
43 bool configureProxy(CURL *curl, const std::string &url);
44 
45 long read_url(CURL *curl, const std::string &url, int fd, std::vector<std::string> *resp_hdrs,
46  const std::vector<std::string> *headers, char error_buffer[]);
47 
48 std::string http_status_to_string(int status);
49 
50 } // namespace httpd_catalog
51 
52 #endif /* I_HTTPD_CURL_UTILS_H_ */