input_file, input_curl: check URL type before attempting to open
Don't attempt to open a HTTP URL as a local file, and don't send a local path to libcurl.
This commit is contained in:
parent
355108666c
commit
0d30d51f07
@ -473,6 +473,9 @@ input_curl_open(struct input_stream *is, const char *url)
|
|||||||
struct input_curl *c;
|
struct input_curl *c;
|
||||||
bool ret;
|
bool ret;
|
||||||
|
|
||||||
|
if (strncmp(url, "http://", 7) != 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
c = g_new0(struct input_curl, 1);
|
c = g_new0(struct input_curl, 1);
|
||||||
c->url = g_strdup(url);
|
c->url = g_strdup(url);
|
||||||
INIT_LIST_HEAD(&c->buffers);
|
INIT_LIST_HEAD(&c->buffers);
|
||||||
|
@ -26,6 +26,9 @@ input_file_open(struct input_stream *is, const char *filename)
|
|||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
|
if (filename[0] != '/')
|
||||||
|
return false;
|
||||||
|
|
||||||
fp = fopen(filename, "r");
|
fp = fopen(filename, "r");
|
||||||
if (!fp) {
|
if (!fp) {
|
||||||
is->error = errno;
|
is->error = errno;
|
||||||
|
Loading…
Reference in New Issue
Block a user