Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
svn
ddnssync
Commits
5ee83a24
Commit
5ee83a24
authored
Sep 27, 2007
by
mr-ti
Browse files
No commit message
No commit message
parent
cb88088a
Changes
3
Hide whitespace changes
Inline
Side-by-side
ddnssbase/ddnsshttpcl.cpp
View file @
5ee83a24
...
...
@@ -11,8 +11,6 @@
//
#include "ddnsshttpcl.h"
#include "cregex.h"
string
*
DdnssHttpCl
::
resBuf
=
NULL
;
CUniMutex
DdnssHttpCl
::
mutResBuf
;
DdnssHttpCl
::
DdnssHttpCl
()
:
CUniObj
()
{
...
...
@@ -21,7 +19,6 @@ DdnssHttpCl::DdnssHttpCl()
handle
=
curl_easy_init
();
//Initialise la lib cURL
curl_easy_setopt
(
handle
,
CURLOPT_USERAGENT
,
"Mozilla/5.0"
);
curl_easy_setopt
(
handle
,
CURLOPT_WRITEFUNCTION
,
writeInRepBuf
);
curl_easy_setopt
(
handle
,
CURLOPT_WRITEDATA
,
NULL
);
//curl_easy_setopt(handle,CURLOPT_TIMEOUT,timeout);
//curl_easy_setopt(handle,CURLOPT_CONNECTTIMEOUT,timeout);
curl_easy_setopt
(
handle
,
CURLOPT_SSL_VERIFYPEER
,
0
);
...
...
@@ -49,20 +46,15 @@ void DdnssHttpCl::setHttpUserPwd(const string &login, const string &passwd){
}
bool
DdnssHttpCl
::
get
(
string
&
result
,
const
string
&
url
){
bool
ret
=
true
;
mutResBuf
.
lock
();
curl_easy_setopt
(
handle
,
CURLOPT_CUSTOMREQUEST
,
"GET"
);
//Paramètre le type de requête
curl_easy_setopt
(
handle
,
CURLOPT_URL
,
url
.
c_str
());
resBuf
=
&
result
;
curl_easy_setopt
(
handle
,
CURLOPT_WRITEDATA
,
&
result
)
;
if
(
curl_easy_perform
(
handle
)
!=
0
)
ret
=
false
;
mutResBuf
.
unlock
();
return
ret
;
return
false
;
return
true
;
}
bool
DdnssHttpCl
::
post
(
string
&
result
,
const
string
&
url
){
bool
ret
=
true
;
mutResBuf
.
lock
();
string
urlTmp
,
data
;
string
::
size_type
n
=
url
.
find
(
'?'
);
if
(
n
!=
string
::
npos
){
...
...
@@ -73,16 +65,15 @@ bool DdnssHttpCl::post(string &result, const string &url){
}
curl_easy_setopt
(
handle
,
CURLOPT_CUSTOMREQUEST
,
"POST"
);
//Paramètre le type de requête
curl_easy_setopt
(
handle
,
CURLOPT_POSTFIELDS
,
data
.
c_str
());
//Enregistre les données de la requête
curl_easy_setopt
(
handle
,
CURLOPT_WRITEDATA
,
&
result
);
curl_easy_setopt
(
handle
,
CURLOPT_URL
,
urlTmp
.
c_str
());
resBuf
=&
result
;
if
(
curl_easy_perform
(
handle
)
!=
0
)
ret
=
false
;
mutResBuf
.
unlock
();
return
ret
;
return
false
;
return
true
;
}
size_t
DdnssHttpCl
::
writeInRepBuf
(
void
*
ptr
,
size_t
size
,
size_t
nmemb
,
FILE
*
out
){
resBuf
->
append
((
char
*
)
ptr
,
size
*
nmemb
);
((
string
*
)
out
)
->
append
((
char
*
)
ptr
,
size
*
nmemb
);
return
size
*
nmemb
;
}
...
...
ddnssbase/ddnsshttpcl.h
View file @
5ee83a24
...
...
@@ -13,7 +13,7 @@
#ifndef DDNSSHTTPCL_H
#define DDNSSHTTPCL_H
#include <curl/curl.h>
#include <unicomctrl/cuni
mutex
.h>
#include <unicomctrl/cuni
obj
.h>
class
DdnssHttpCl
:
public
CUniObj
{
public:
...
...
@@ -28,8 +28,6 @@ private:
string
publicIpGetAdress
;
CURL
*
handle
;
static
size_t
writeInRepBuf
(
void
*
ptr
,
size_t
size
,
size_t
nmemb
,
FILE
*
out
);
static
CUniMutex
mutResBuf
;
static
string
*
resBuf
;
};
#endif
ddnssync/ddnssslist.h
View file @
5ee83a24
...
...
@@ -32,9 +32,11 @@ public:
string
dname
;
CUniStringList
cmdList
;
};
DDnsSSList
();
DDnsSSList
(
CUniConf
&
cf
);
~
DDnsSSList
();
virtual
string
className
();
private:
list
<
DName
*>
dnList
;
};
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment