File: HTTPRequest.h

package info (click to toggle)
spectrum2 2.2.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,548 kB
  • sloc: cpp: 32,594; python: 1,751; javascript: 273; makefile: 34; sql: 31; xml: 10
file content (37 lines) | stat: -rw-r--r-- 707 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef HTTPREQ_H
#define HTTPREQ_H

#include "curl/curl.h"
#include "transport/Logging.h"
#include <iostream>
#include <sstream>
#include <string.h>

class HTTPRequest
{
	CURL *curlhandle;
	char curl_errorbuffer[1024];
	std::string error;
	std::string callbackdata;

    static int curlCallBack(char* data, size_t size, size_t nmemb, HTTPRequest *obj);

	public:
	HTTPRequest() {
		curlhandle = NULL;
	}

	~HTTPRequest() {
		if(curlhandle) {
			curl_easy_cleanup(curlhandle);
			curlhandle = NULL;
		}
	}

	bool init();
	void setProxy(std::string, std::string, std::string, std::string);
	bool GET(std::string, std::string &);
	std::string getCurlError() {return std::string(curl_errorbuffer);}
};

#endif