Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
07be44a5
Commit
07be44a5
authored
Aug 19, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib/curl/Easy: add getter functions
parent
7a473729
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
1 deletion
+19
-1
Easy.hxx
src/lib/curl/Easy.hxx
+18
-0
Request.cxx
src/lib/curl/Request.cxx
+1
-1
No files found.
src/lib/curl/Easy.hxx
View file @
07be44a5
...
@@ -30,6 +30,8 @@
...
@@ -30,6 +30,8 @@
#ifndef CURL_EASY_HXX
#ifndef CURL_EASY_HXX
#define CURL_EASY_HXX
#define CURL_EASY_HXX
#include "util/Compiler.h"
#include <curl/curl.h>
#include <curl/curl.h>
#include <utility>
#include <utility>
...
@@ -160,6 +162,22 @@ public:
...
@@ -160,6 +162,22 @@ public:
SetOption
(
CURLOPT_HTTPPOST
,
post
);
SetOption
(
CURLOPT_HTTPPOST
,
post
);
}
}
template
<
typename
T
>
bool
GetInfo
(
CURLINFO
info
,
T
value_r
)
const
noexcept
{
return
::
curl_easy_getinfo
(
handle
,
info
,
value_r
)
==
CURLE_OK
;
}
/**
* Returns the response body's size, or -1 if that is unknown.
*/
gcc_pure
int64_t
GetContentLength
()
const
noexcept
{
double
value
;
return
GetInfo
(
CURLINFO_CONTENT_LENGTH_DOWNLOAD
,
&
value
)
?
(
int64_t
)
value
:
-
1
;
}
bool
Unpause
()
noexcept
{
bool
Unpause
()
noexcept
{
return
::
curl_easy_pause
(
handle
,
CURLPAUSE_CONT
)
==
CURLE_OK
;
return
::
curl_easy_pause
(
handle
,
CURLPAUSE_CONT
)
==
CURLE_OK
;
}
}
...
...
src/lib/curl/Request.cxx
View file @
07be44a5
...
@@ -140,7 +140,7 @@ CurlRequest::FinishHeaders()
...
@@ -140,7 +140,7 @@ CurlRequest::FinishHeaders()
state
=
State
::
BODY
;
state
=
State
::
BODY
;
long
status
=
0
;
long
status
=
0
;
curl_easy_getinfo
(
easy
.
Get
(),
CURLINFO_RESPONSE_CODE
,
&
status
);
easy
.
GetInfo
(
CURLINFO_RESPONSE_CODE
,
&
status
);
handler
.
OnHeaders
(
status
,
std
::
move
(
headers
));
handler
.
OnHeaders
(
status
,
std
::
move
(
headers
));
}
}
...
...
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