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:
Max Kellermann 2008-10-27 10:10:24 +01:00
parent 355108666c
commit 0d30d51f07
2 changed files with 6 additions and 0 deletions

View File

@ -473,6 +473,9 @@ input_curl_open(struct input_stream *is, const char *url)
struct input_curl *c;
bool ret;
if (strncmp(url, "http://", 7) != 0)
return false;
c = g_new0(struct input_curl, 1);
c->url = g_strdup(url);
INIT_LIST_HEAD(&c->buffers);

View File

@ -26,6 +26,9 @@ input_file_open(struct input_stream *is, const char *filename)
{
FILE *fp;
if (filename[0] != '/')
return false;
fp = fopen(filename, "r");
if (!fp) {
is->error = errno;