Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
b6ba072e
Commit
b6ba072e
authored
Jul 11, 2003
by
Gildas Bazin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* include/httpd.h: compilation fix.
* modules/control/http.c: win32 fixes.
parent
a3285e7c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
33 deletions
+36
-33
include/httpd.h
include/httpd.h
+5
-2
modules/control/http.c
modules/control/http.c
+31
-31
No files found.
include/httpd.h
View file @
b6ba072e
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* httpd.h
* httpd.h
*****************************************************************************
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
* Copyright (C) 2001-2003 VideoLAN
* $Id: httpd.h,v 1.
6 2003/07/10 22:24:09 fenrir
Exp $
* $Id: httpd.h,v 1.
7 2003/07/11 09:50:10 gbazin
Exp $
*
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
*
...
@@ -28,7 +28,8 @@ typedef struct httpd_file_t httpd_file_t;
...
@@ -28,7 +28,8 @@ typedef struct httpd_file_t httpd_file_t;
typedef
httpd_file_t
httpd_stream_t
;
typedef
httpd_file_t
httpd_stream_t
;
typedef
struct
httpd_file_callback_args_t
httpd_file_callback_args_t
;
typedef
struct
httpd_file_callback_args_t
httpd_file_callback_args_t
;
typedef
int
(
*
httpd_file_callback
)(
httpd_file_callback_args_t
*
p_args
,
uint8_t
*
p_request
,
int
i_request
,
uint8_t
**
pp_data
,
int
*
pi_data
);
typedef
int
(
*
httpd_file_callback
)(
httpd_file_callback_args_t
*
p_args
,
uint8_t
*
p_request
,
int
i_request
,
uint8_t
**
pp_data
,
int
*
pi_data
);
typedef
struct
httpd_sys_t
httpd_sys_t
;
typedef
struct
httpd_sys_t
httpd_sys_t
;
...
@@ -56,6 +57,8 @@ typedef struct
...
@@ -56,6 +57,8 @@ typedef struct
}
httpd_info_t
;
}
httpd_info_t
;
typedef
struct
httpd_t
httpd_t
;
struct
httpd_t
struct
httpd_t
{
{
VLC_COMMON_MEMBERS
VLC_COMMON_MEMBERS
...
...
modules/control/http.c
View file @
b6ba072e
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* http.c : http mini-server ;)
* http.c : http mini-server ;)
*****************************************************************************
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* Copyright (C) 2001 VideoLAN
* $Id: http.c,v 1.1
1 2003/07/10 22:24:09 fenrir
Exp $
* $Id: http.c,v 1.1
2 2003/07/11 09:50:10 gbazin
Exp $
*
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
* Authors: Gildas Bazin <gbazin@netcourrier.com>
* Laurent Aimar <fenrir@via.ecp.fr>
* Laurent Aimar <fenrir@via.ecp.fr>
...
@@ -60,7 +60,8 @@ static int Activate ( vlc_object_t * );
...
@@ -60,7 +60,8 @@ static int Activate ( vlc_object_t * );
static
void
Close
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
void
Run
(
intf_thread_t
*
p_intf
);
static
void
Run
(
intf_thread_t
*
p_intf
);
static
int
ParseDirectory
(
intf_thread_t
*
p_intf
,
char
*
psz_root
,
char
*
psz_dir
);
static
int
ParseDirectory
(
intf_thread_t
*
p_intf
,
char
*
psz_root
,
char
*
psz_dir
);
static
int
http_get
(
httpd_file_callback_args_t
*
p_args
,
static
int
http_get
(
httpd_file_callback_args_t
*
p_args
,
uint8_t
*
p_request
,
int
i_request
,
uint8_t
*
p_request
,
int
i_request
,
...
@@ -199,20 +200,14 @@ static int Activate( vlc_object_t *p_this )
...
@@ -199,20 +200,14 @@ static int Activate( vlc_object_t *p_this )
p_sys
->
i_files
=
0
;
p_sys
->
i_files
=
0
;
p_sys
->
pp_files
=
malloc
(
sizeof
(
httpd_file_callback_args_t
*
)
);
p_sys
->
pp_files
=
malloc
(
sizeof
(
httpd_file_callback_args_t
*
)
);
#if defined(SYS_DARWIN) || defined(SYS_BEOS)
#if defined(SYS_DARWIN) || defined(SYS_BEOS) || \
( defined(WIN32) && !defined(UNDER_CE ) )
if
(
(
psz_src
=
config_GetPsz
(
p_intf
,
"http-src"
))
==
NULL
)
if
(
(
psz_src
=
config_GetPsz
(
p_intf
,
"http-src"
))
==
NULL
)
{
{
char
*
psz_vlcpath
=
p_intf
->
p_libvlc
->
psz_vlcpath
;
char
*
psz_vlcpath
=
p_intf
->
p_libvlc
->
psz_vlcpath
;
psz_src
=
malloc
(
strlen
(
psz_vlcpath
)
+
strlen
(
"/share/http"
)
+
1
);
psz_src
=
malloc
(
strlen
(
psz_vlcpath
)
+
strlen
(
"/share/http"
)
+
1
);
sprintf
(
psz_src
,
"%s/share/http"
,
psz_vlcpath
);
sprintf
(
psz_src
,
"%s/share/http"
,
psz_vlcpath
);
}
}
#elif defined(WIN32) && !defined(UNDER_CE)
if
(
(
psz_src
=
config_GetPsz
(
p_intf
,
"http-src"
))
==
NULL
)
{
char
*
psz_vlcpath
=
p_intf
->
p_libvlc
->
psz_vlcpath
;
psz_src
=
malloc
(
strlen
(
psz_vlcpath
)
+
strlen
(
"
\\
share
\\
http"
)
+
1
);
sprintf
(
psz_src
,
"%s
\\
share
\\
"
,
psz_vlcpath
);
}
#else
#else
psz_src
=
config_GetPsz
(
p_intf
,
"http-src"
);
psz_src
=
config_GetPsz
(
p_intf
,
"http-src"
);
#endif
#endif
...
@@ -342,32 +337,28 @@ static char *FileToUrl( char *name )
...
@@ -342,32 +337,28 @@ static char *FileToUrl( char *name )
url
=
p
=
malloc
(
strlen
(
name
)
+
1
);
url
=
p
=
malloc
(
strlen
(
name
)
+
1
);
#ifdef WIN32
#ifdef WIN32
while
(
*
name
==
'\\'
||
*
name
==
'/'
)
#else
while
(
*
name
==
'\\'
)
while
(
*
name
==
'\\'
)
#endif
{
{
name
++
;
name
++
;
}
}
*
p
++
=
'/'
;
*
p
++
=
'/'
;
strcpy
(
p
,
name
);
#ifdef WIN32
/* convert '\\' into '/' */
name
=
p
;
while
(
*
name
)
while
(
*
name
)
{
{
if
(
*
name
==
'\\'
)
if
(
*
name
==
'\\'
)
{
{
*
p
++
=
'/'
;
*
p
++
=
'/'
;
}
}
else
{
*
p
++
=
*
name
;
}
name
++
;
name
++
;
}
}
*
p
++
=
'\0'
;
#else
while
(
name
[
0
]
==
'/'
)
{
name
++
;
}
*
p
++
=
'/'
;
strcpy
(
p
,
name
);
#endif
#endif
/* index.* -> / */
/* index.* -> / */
...
@@ -439,7 +430,8 @@ static char *FileToMime( char *psz_name )
...
@@ -439,7 +430,8 @@ static char *FileToMime( char *psz_name )
/****************************************************************************
/****************************************************************************
* ParseDirectory: parse recursively a directory, adding each file
* ParseDirectory: parse recursively a directory, adding each file
****************************************************************************/
****************************************************************************/
static
int
ParseDirectory
(
intf_thread_t
*
p_intf
,
char
*
psz_root
,
char
*
psz_dir
)
static
int
ParseDirectory
(
intf_thread_t
*
p_intf
,
char
*
psz_root
,
char
*
psz_dir
)
{
{
intf_sys_t
*
p_sys
=
p_intf
->
p_sys
;
intf_sys_t
*
p_sys
=
p_intf
->
p_sys
;
char
dir
[
MAX_DIR_SIZE
];
char
dir
[
MAX_DIR_SIZE
];
...
@@ -454,7 +446,7 @@ static int ParseDirectory( intf_thread_t *p_intf, char *psz_root, char *psz_dir
...
@@ -454,7 +446,7 @@ static int ParseDirectory( intf_thread_t *p_intf, char *psz_root, char *psz_dir
char
*
password
=
NULL
;
char
*
password
=
NULL
;
#ifdef HAVE_SYS_STAT_H
#ifdef HAVE_SYS_STAT_H
if
(
(
stat
(
psz_dir
,
&
stat_info
)
==
-
1
)
||
!
S_ISDIR
(
stat_info
.
st_mode
)
)
if
(
stat
(
psz_dir
,
&
stat_info
)
==
-
1
||
!
S_ISDIR
(
stat_info
.
st_mode
)
)
{
{
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
...
@@ -480,7 +472,8 @@ static int ParseDirectory( intf_thread_t *p_intf, char *psz_root, char *psz_dir
...
@@ -480,7 +472,8 @@ static int ParseDirectory( intf_thread_t *p_intf, char *psz_root, char *psz_dir
if
(
i_size
>
0
)
if
(
i_size
>
0
)
{
{
char
*
p
;
char
*
p
;
while
(
i_size
>
0
&&
(
line
[
i_size
-
1
]
==
'\n'
||
line
[
i_size
-
1
]
==
'\r'
)
)
while
(
i_size
>
0
&&
(
line
[
i_size
-
1
]
==
'\n'
||
line
[
i_size
-
1
]
==
'\r'
)
)
{
{
i_size
--
;
i_size
--
;
}
}
...
@@ -495,7 +488,8 @@ static int ParseDirectory( intf_thread_t *p_intf, char *psz_root, char *psz_dir
...
@@ -495,7 +488,8 @@ static int ParseDirectory( intf_thread_t *p_intf, char *psz_root, char *psz_dir
password
=
strdup
(
p
);
password
=
strdup
(
p
);
}
}
}
}
msg_Dbg
(
p_intf
,
"using user=%s password=%s (read=%d)"
,
user
,
password
,
i_size
);
msg_Dbg
(
p_intf
,
"using user=%s password=%s (read=%d)"
,
user
,
password
,
i_size
);
fclose
(
file
);
fclose
(
file
);
}
}
...
@@ -522,7 +516,8 @@ static int ParseDirectory( intf_thread_t *p_intf, char *psz_root, char *psz_dir
...
@@ -522,7 +516,8 @@ static int ParseDirectory( intf_thread_t *p_intf, char *psz_root, char *psz_dir
f
->
name
=
FileToUrl
(
&
dir
[
strlen
(
psz_root
)]
);
f
->
name
=
FileToUrl
(
&
dir
[
strlen
(
psz_root
)]
);
f
->
mime
=
FileToMime
(
&
dir
[
strlen
(
psz_root
)]
);
f
->
mime
=
FileToMime
(
&
dir
[
strlen
(
psz_root
)]
);
msg_Dbg
(
p_intf
,
"file=%s (url=%s mime=%s)"
,
f
->
file
,
f
->
name
,
f
->
mime
);
msg_Dbg
(
p_intf
,
"file=%s (url=%s mime=%s)"
,
f
->
file
,
f
->
name
,
f
->
mime
);
f
->
p_file
=
f
->
p_file
=
p_sys
->
p_httpd
->
pf_register_file
(
p_sys
->
p_httpd
,
p_sys
->
p_httpd
->
pf_register_file
(
p_sys
->
p_httpd
,
...
@@ -533,12 +528,14 @@ static int ParseDirectory( intf_thread_t *p_intf, char *psz_root, char *psz_dir
...
@@ -533,12 +528,14 @@ static int ParseDirectory( intf_thread_t *p_intf, char *psz_root, char *psz_dir
if
(
f
->
p_file
)
if
(
f
->
p_file
)
{
{
p_sys
->
i_files
++
;
p_sys
->
i_files
++
;
p_sys
->
pp_files
=
realloc
(
p_sys
->
pp_files
,
(
p_sys
->
i_files
+
1
)
*
sizeof
(
httpd_file_callback_args_t
)
);
p_sys
->
pp_files
=
realloc
(
p_sys
->
pp_files
,
(
p_sys
->
i_files
+
1
)
*
sizeof
(
httpd_file_callback_args_t
)
);
}
}
#define fold p_sys->pp_files[p_sys->i_files-1]
#define fold p_sys->pp_files[p_sys->i_files-1]
/* FIXME for rep/ add rep (it would be better to do a redirection) */
/* FIXME for rep/ add rep (it would be better to do a redirection) */
if
(
strlen
(
fold
->
name
)
>
1
&&
fold
->
name
[
strlen
(
fold
->
name
)
-
1
]
==
'/'
)
if
(
strlen
(
fold
->
name
)
>
1
&&
fold
->
name
[
strlen
(
fold
->
name
)
-
1
]
==
'/'
)
{
{
f
=
malloc
(
sizeof
(
httpd_file_callback_args_t
)
);
f
=
malloc
(
sizeof
(
httpd_file_callback_args_t
)
);
f
->
p_intf
=
p_intf
;
f
->
p_intf
=
p_intf
;
...
@@ -547,7 +544,8 @@ static int ParseDirectory( intf_thread_t *p_intf, char *psz_root, char *psz_dir
...
@@ -547,7 +544,8 @@ static int ParseDirectory( intf_thread_t *p_intf, char *psz_root, char *psz_dir
f
->
mime
=
fold
->
mime
;
f
->
mime
=
fold
->
mime
;
f
->
name
[
strlen
(
f
->
name
)
-
1
]
=
'\0'
;
f
->
name
[
strlen
(
f
->
name
)
-
1
]
=
'\0'
;
msg_Dbg
(
p_intf
,
"file=%s (url=%s mime=%s)"
,
f
->
file
,
f
->
name
,
f
->
mime
);
msg_Dbg
(
p_intf
,
"file=%s (url=%s mime=%s)"
,
f
->
file
,
f
->
name
,
f
->
mime
);
f
->
p_file
=
f
->
p_file
=
p_sys
->
p_httpd
->
pf_register_file
(
p_sys
->
p_httpd
,
p_sys
->
p_httpd
->
pf_register_file
(
p_sys
->
p_httpd
,
f
->
name
,
f
->
mime
,
f
->
name
,
f
->
mime
,
...
@@ -557,7 +555,9 @@ static int ParseDirectory( intf_thread_t *p_intf, char *psz_root, char *psz_dir
...
@@ -557,7 +555,9 @@ static int ParseDirectory( intf_thread_t *p_intf, char *psz_root, char *psz_dir
if
(
f
->
p_file
)
if
(
f
->
p_file
)
{
{
p_sys
->
i_files
++
;
p_sys
->
i_files
++
;
p_sys
->
pp_files
=
realloc
(
p_sys
->
pp_files
,
(
p_sys
->
i_files
+
1
)
*
sizeof
(
httpd_file_callback_args_t
)
);
p_sys
->
pp_files
=
realloc
(
p_sys
->
pp_files
,
(
p_sys
->
i_files
+
1
)
*
sizeof
(
httpd_file_callback_args_t
)
);
}
}
}
}
#undef fold
#undef fold
...
...
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