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
ff162b5a
Commit
ff162b5a
authored
Oct 24, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input/curl: move code to StartRequest()
parent
d8e4705d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
CurlInputPlugin.cxx
src/input/plugins/CurlInputPlugin.cxx
+18
-0
No files found.
src/input/plugins/CurlInputPlugin.cxx
View file @
ff162b5a
...
...
@@ -85,9 +85,20 @@ struct CurlInputStream final : public AsyncInputStream, CurlResponseHandler {
static
InputStream
*
Open
(
const
char
*
url
,
Mutex
&
mutex
,
Cond
&
cond
);
/**
* Create and initialize a new #CurlRequest instance. After
* this, you may add more request headers and set options. To
* actually start the request, call StartRequest().
*/
void
InitEasy
();
/**
* Start the request after having called InitEasy(). After
* this, you must not set any CURL options.
*/
void
StartRequest
();
/**
* Frees the current "libcurl easy" handle, and everything
* associated with it.
*
...
...
@@ -371,6 +382,11 @@ CurlInputStream::InitEasy()
request_headers
.
Clear
();
request_headers
.
Append
(
"Icy-Metadata: 1"
);
}
void
CurlInputStream
::
StartRequest
()
{
request
->
SetOption
(
CURLOPT_HTTPHEADER
,
request_headers
.
Get
());
request
->
Start
();
...
...
@@ -393,6 +409,7 @@ CurlInputStream::SeekInternal(offset_type new_offset)
}
InitEasy
();
StartRequest
();
/* send the "Range" header */
...
...
@@ -428,6 +445,7 @@ CurlInputStream::Open(const char *url, Mutex &mutex, Cond &cond)
try
{
BlockingCall
(
io_thread_get
(),
[
c
](){
c
->
InitEasy
();
c
->
StartRequest
();
});
}
catch
(...)
{
delete
c
;
...
...
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