Nebula
Toggle main menu visibility
Loading...
Searching...
No Matches
curlhttpclient.h
Go to the documentation of this file.
1
#pragma once
2
//------------------------------------------------------------------------------
15
#include "
core/config.h
"
16
#include "
core/refcounted.h
"
17
#include "
http/httpstatus.h
"
18
#include "
http/httpmethod.h
"
19
#include "
io/uri.h
"
20
#include "
io/stream.h
"
21
22
#ifdef USE_CURL
23
//------------------------------------------------------------------------------
24
namespace
Http
25
{
26
class
CurlHttpClient :
public
Core::RefCounted
27
{
28
__DeclareClass
(CurlHttpClient);
29
public
:
31
CurlHttpClient();
33
virtual
~CurlHttpClient();
34
36
void
SetUserAgent(
const
Util::String& userAgent);
38
const
Util::String& GetUserAgent()
const
;
39
41
bool
Connect(
const
IO::URI& uri);
43
void
Disconnect();
45
bool
IsConnected()
const
;
46
48
HttpStatus::Code SendRequest(HttpMethod::Code requestMethod,
const
IO::URI& uri,
const
Ptr<IO::Stream>& responseContentStream);
50
HttpStatus::Code SendRequest(HttpMethod::Code requestMethod,
const
IO::URI& uri,
const
Util::String & body,
const
Ptr<IO::Stream>& responseContentStream);
51
private
:
52
Util::String userAgent;
53
void
* curlSession;
54
char
* curlErrorBuffer;
55
57
static
size_t
CurlWriteDataCallback(
char
* ptr,
size_t
size,
size_t
nmemb,
void
* userData);
59
static
size_t
CurlHeaderCallback(
char
* ptr,
size_t
size,
size_t
nmenb,
void
* userData);
60
};
61
62
//------------------------------------------------------------------------------
65
inline
void
66
CurlHttpClient::SetUserAgent(
const
Util::String
& agent)
67
{
68
this->userAgent = agent;
69
}
70
71
//------------------------------------------------------------------------------
74
inline
const
Util::String
&
75
CurlHttpClient::GetUserAgent()
const
76
{
77
return
this->userAgent;
78
}
79
80
}
// namespace Http
81
//------------------------------------------------------------------------------
82
#endif
Core::RefCounted
The common base class of Nebula.
Definition
refcounted.h:38
config.h
Nebula compiler specific defines and configuration.
httpmethod.h
httpstatus.h
Http
This file was generated with Nebula Trifid's idlc compiler tool.
Definition
defaulthttprequesthandler.cc:15
refcounted.h
__DeclareClass
#define __DeclareClass(type)
stream.h
Util.String
Nebula's universal string class.
Definition
String.cs:8
uri.h
code
foundation
http
curl
curlhttpclient.h
Generated on
for Nebula. Dark theme by
Tilen Majerle
. All rights reserved.