Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
dc4c75fe
Commit
dc4c75fe
authored
Jul 29, 2003
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* http.c: under linux if no directory is specified search "share/http"
and then DATA_PATH"/http".
parent
42b0d326
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
26 deletions
+59
-26
modules/control/http.c
modules/control/http.c
+59
-26
No files found.
modules/control/http.c
View file @
dc4c75fe
...
...
@@ -2,7 +2,7 @@
* http.c : http mini-server ;)
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: http.c,v 1.1
7 2003/07/23 01:13:47 gbazin
Exp $
* $Id: http.c,v 1.1
8 2003/07/29 18:51:16 fenrir
Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
* Laurent Aimar <fenrir@via.ecp.fr>
...
...
@@ -60,17 +60,59 @@
# include <dirent.h>
#endif
/*****************************************************************************
*
Local prototypes
*
Module descriptor
*****************************************************************************/
static
int
Activate
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
#define HOST_TEXT N_( "Host address" )
#define HOST_LONGTEXT N_( \
"You can set the address and port on which the http interface will bind" )
#define SRC_TEXT N_( "Source directory" )
#define SRC_LONGTEXT N_( "Source directory" )
vlc_module_begin
();
set_description
(
_
(
"HTTP remote control interface"
)
);
add_category_hint
(
N_
(
"HTTP remote control"
),
NULL
,
VLC_TRUE
);
add_string
(
"http-host"
,
NULL
,
NULL
,
HOST_TEXT
,
HOST_LONGTEXT
,
VLC_TRUE
);
add_string
(
"http-src"
,
NULL
,
NULL
,
SRC_TEXT
,
SRC_LONGTEXT
,
VLC_TRUE
);
set_capability
(
"interface"
,
0
);
set_callbacks
(
Activate
,
Close
);
vlc_module_end
();
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static
void
Run
(
intf_thread_t
*
p_intf
);
static
int
ParseDirectory
(
intf_thread_t
*
p_intf
,
char
*
psz_root
,
char
*
psz_dir
);
static
int
DirectoryCheck
(
char
*
psz_dir
)
{
DIR
*
p_dir
;
#ifdef HAVE_SYS_STAT_H
struct
stat
stat_info
;
if
(
stat
(
psz_dir
,
&
stat_info
)
==
-
1
||
!
S_ISDIR
(
stat_info
.
st_mode
)
)
{
return
VLC_EGENERIC
;
}
#endif
if
(
(
p_dir
=
opendir
(
psz_dir
)
)
==
NULL
)
{
return
VLC_EGENERIC
;
}
closedir
(
p_dir
);
return
VLC_SUCCESS
;
}
static
int
http_get
(
httpd_file_callback_args_t
*
p_args
,
uint8_t
*
p_request
,
int
i_request
,
uint8_t
**
pp_data
,
int
*
pi_data
);
...
...
@@ -125,28 +167,6 @@ struct intf_sys_t
};
/*****************************************************************************
* Module descriptor
*****************************************************************************/
#define HOST_TEXT N_( "Host address" )
#define HOST_LONGTEXT N_( \
"You can set the address and port on which the http interface will bind" )
#define SRC_TEXT N_( "Source directory" )
#define SRC_LONGTEXT N_( "Source directory" )
vlc_module_begin
();
set_description
(
_
(
"HTTP remote control interface"
)
);
add_category_hint
(
N_
(
"HTTP remote control"
),
NULL
,
VLC_TRUE
);
add_string
(
"http-host"
,
NULL
,
NULL
,
HOST_TEXT
,
HOST_LONGTEXT
,
VLC_TRUE
);
#if defined(SYS_DARWIN) || defined(SYS_BEOS) \
|| (defined(WIN32) && !defined(UNDER_CE))
add_string
(
"http-src"
,
NULL
,
NULL
,
SRC_TEXT
,
SRC_LONGTEXT
,
VLC_TRUE
);
#else
add_string
(
"http-src"
,
"share/http"
,
NULL
,
SRC_TEXT
,
SRC_LONGTEXT
,
VLC_TRUE
);
#endif
set_capability
(
"interface"
,
0
);
set_callbacks
(
Activate
,
Close
);
vlc_module_end
();
/*****************************************************************************
* Activate: initialize and create stuff
...
...
@@ -218,7 +238,20 @@ static int Activate( vlc_object_t *p_this )
}
#else
psz_src
=
config_GetPsz
(
p_intf
,
"http-src"
);
if
(
!
psz_src
||
*
psz_src
==
'\0'
)
{
if
(
!
DirectoryCheck
(
"share/http"
)
)
{
psz_src
=
strdup
(
"share/http"
);
}
else
if
(
!
DirectoryCheck
(
DATA_PATH
"/http"
)
)
{
psz_src
=
strdup
(
DATA_PATH
"/http"
);
}
}
#endif
if
(
!
psz_src
||
*
psz_src
==
'\0'
)
{
msg_Err
(
p_intf
,
"invalid src dir"
);
...
...
@@ -237,7 +270,7 @@ static int Activate( vlc_object_t *p_this )
if
(
p_sys
->
i_files
<=
0
)
{
msg_Err
(
p_intf
,
"cannot find any files
"
);
msg_Err
(
p_intf
,
"cannot find any files
(%s)"
,
psz_src
);
goto
failed
;
}
p_intf
->
pf_run
=
Run
;
...
...
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