NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
http.h
Go to the documentation of this file.
1/*****************************************************************************
2 NumeRe: Framework fuer Numerische Rechnungen
3 Copyright (C) 2021 Erik Haenel et al.
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17******************************************************************************/
18
19
20#ifndef HTTP_H
21#define HTTP_H
22
23#include <string>
24#include <exception>
25
26namespace url
27{
31 class Error : public std::exception
32 {
33 private:
34 std::string m_what;
35
36 public:
37 Error(const std::string& what) : m_what(what) {}
38 virtual const char* what() const noexcept
39 {
40 return m_what.c_str();
41 }
42 };
43
44 std::string get(const std::string& sUrl, const std::string& sUserName = "", const std::string& sPassWord = "");
45 size_t put(const std::string& sUrl, const std::string& sFileName, const std::string& sUserName = "", const std::string& sPassWord = "");
46}
47
48#endif // HTTP_H
49
A class for URL exceptions.
Definition: http.h:32
virtual const char * what() const noexcept
Definition: http.h:38
Error(const std::string &what)
Definition: http.h:37
std::string m_what
Definition: http.h:34
Definition: http.cpp:32
size_t put(const std::string &sUrl, const std::string &sFileName, const std::string &sUserName, const std::string &sPassWord)
Upload a file to a destination and return the transmitted bytes.
Definition: http.cpp:286
std::string get(const std::string &sUrl, const std::string &sUserName, const std::string &sPassWord)
Get the contents of a URL.
Definition: http.cpp:251