00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef INCL_CURL_TRANSPORT_AGENT
00020 #define INCL_CURL_TRANSPORT_AGENT
00021
00023 #include "base/fscapi.h"
00024
00025 #include "http/URL.h"
00026 #include "http/Proxy.h"
00027 #include "http/TransportAgent.h"
00028
00029 #include "curl/curl.h"
00030
00031
00032
00033
00034
00035
00036 class CurlTransportAgent : public TransportAgent {
00037 CURL *easyhandle;
00038 char proxyauth[DIM_USERNAME + 1 + DIM_PASSWORD];
00039
00040 char *sendbuffer;
00041 size_t sent, sendbuffersize;
00042 static size_t sendData(void *ptr, size_t size, size_t nmemb, void *stream);
00043
00044 char *responsebuffer;
00045 size_t received, responsebuffersize;
00046 static size_t receiveData(void *buffer, size_t size, size_t nmemb, void *stream);
00047
00048 char curlerrortxt[CURL_ERROR_SIZE];
00049
00050 static int debugCallback(CURL *easyhandle, curl_infotype type, char *data, size_t size, void *unused);
00051
00052 public:
00053 CurlTransportAgent();
00054 CurlTransportAgent(URL& url, Proxy& proxy, unsigned int responseTimeout = DEFAULT_MAX_TIMEOUT);
00055 ~CurlTransportAgent();
00056
00057 char* sendMessage(const char* msg);
00058 void setUserAgent(const char* ua);
00059
00060 };
00061
00063 #endif