26#ifndef http_response_h
27#define http_response_h
52 std::vector<std::string> d_headers;
76 HTTPResponse(FILE *s,
int status,
const std::vector<std::string> &h,
const std::string &temp_file)
77 :
Response(s, status), d_headers(h), d_file(temp_file) {}
87 HTTPResponse(std::fstream *s,
int status,
const std::vector<std::string> &h,
const std::string &temp_file)
88 :
Response(s, status), d_headers(h), d_file(temp_file) {}
95 (void)unlink(d_file.c_str());
109 set_cpp_stream(
new std::fstream(d_file.c_str(), std::ios::in | std::ios::binary));
119 virtual std::vector<std::string> &
get_headers() {
return d_headers; }
120 virtual std::string
get_file()
const {
return d_file; }
125 virtual void set_headers(std::vector<std::string> &h) { d_headers = h; }
126 virtual void set_file(
const std::string &n) { d_file = n; }
virtual std::vector< std::string > & get_headers()
virtual std::string get_file() const
HTTPResponse & operator=(const HTTPResponse &)=delete
HTTPResponse(const HTTPResponse &rs)=delete
virtual void set_file(const std::string &n)
virtual void set_headers(std::vector< std::string > &h)
HTTPResponse(FILE *s, int status, const std::vector< std::string > &h, const std::string &temp_file)
HTTPResponse(std::fstream *s, int status, const std::vector< std::string > &h, const std::string &temp_file)
Build a HTTPResponse using a cpp fstream When working with DAP4 responses, use C++ streams for I/0.
bool d_delete_cpp_stream_ptr
virtual void set_cpp_stream(std::istream *s)
top level DAP object to house generic methods