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
f392e130
Commit
f392e130
authored
7 years ago
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input/curl: pass additional request headers to constructor
Prepare to allow callers to pass custom request headers.
parent
3fe5b42b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
CurlInputPlugin.cxx
src/input/plugins/CurlInputPlugin.cxx
+13
-4
No files found.
src/input/plugins/CurlInputPlugin.cxx
View file @
f392e130
...
...
@@ -78,6 +78,7 @@ class CurlInputStream final : public AsyncInputStream, CurlResponseHandler {
public
:
template
<
typename
I
>
CurlInputStream
(
EventLoop
&
event_loop
,
const
char
*
_url
,
const
std
::
multimap
<
std
::
string
,
std
::
string
>
&
headers
,
I
&&
_icy
,
Mutex
&
_mutex
,
Cond
&
_cond
);
...
...
@@ -86,7 +87,9 @@ public:
CurlInputStream
(
const
CurlInputStream
&
)
=
delete
;
CurlInputStream
&
operator
=
(
const
CurlInputStream
&
)
=
delete
;
static
InputStreamPtr
Open
(
const
char
*
url
,
Mutex
&
mutex
,
Cond
&
cond
);
static
InputStreamPtr
Open
(
const
char
*
url
,
const
std
::
multimap
<
std
::
string
,
std
::
string
>
&
headers
,
Mutex
&
mutex
,
Cond
&
cond
);
private
:
/**
...
...
@@ -344,6 +347,7 @@ input_curl_finish() noexcept
template
<
typename
I
>
inline
CurlInputStream
::
CurlInputStream
(
EventLoop
&
event_loop
,
const
char
*
_url
,
const
std
::
multimap
<
std
::
string
,
std
::
string
>
&
headers
,
I
&&
_icy
,
Mutex
&
_mutex
,
Cond
&
_cond
)
:
AsyncInputStream
(
event_loop
,
_url
,
_mutex
,
_cond
,
...
...
@@ -352,6 +356,9 @@ CurlInputStream::CurlInputStream(EventLoop &event_loop, const char *_url,
icy
(
std
::
forward
<
I
>
(
_icy
))
{
request_headers
.
Append
(
"Icy-Metadata: 1"
);
for
(
const
auto
&
i
:
headers
)
request_headers
.
Append
((
i
.
first
+
":"
+
i
.
second
).
c_str
());
}
CurlInputStream
::~
CurlInputStream
()
noexcept
...
...
@@ -442,12 +449,14 @@ CurlInputStream::DoSeek(offset_type new_offset)
}
inline
InputStreamPtr
CurlInputStream
::
Open
(
const
char
*
url
,
Mutex
&
mutex
,
Cond
&
cond
)
CurlInputStream
::
Open
(
const
char
*
url
,
const
std
::
multimap
<
std
::
string
,
std
::
string
>
&
headers
,
Mutex
&
mutex
,
Cond
&
cond
)
{
auto
icy
=
std
::
make_shared
<
IcyMetaDataParser
>
();
auto
c
=
std
::
make_unique
<
CurlInputStream
>
((
*
curl_init
)
->
GetEventLoop
(),
url
,
url
,
headers
,
icy
,
mutex
,
cond
);
...
...
@@ -466,7 +475,7 @@ input_curl_open(const char *url, Mutex &mutex, Cond &cond)
strncmp
(
url
,
"https://"
,
8
)
!=
0
)
return
nullptr
;
return
CurlInputStream
::
Open
(
url
,
mutex
,
cond
);
return
CurlInputStream
::
Open
(
url
,
{},
mutex
,
cond
);
}
const
struct
InputPlugin
input_plugin_curl
=
{
...
...
This diff is collapsed.
Click to expand it.
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