Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
7656b8c5
Commit
7656b8c5
authored
Aug 02, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Factor HTTP/HTTPS/RTSP port in core
parent
de8438c3
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
66 additions
and
102 deletions
+66
-102
include/vlc_httpd.h
include/vlc_httpd.h
+3
-3
modules/access/dvb/http.c
modules/access/dvb/http.c
+2
-27
modules/access_output/http.c
modules/access_output/http.c
+5
-37
modules/lua/libs/httpd.c
modules/lua/libs/httpd.c
+2
-3
modules/misc/rtsp.c
modules/misc/rtsp.c
+1
-1
modules/stream_out/rtp.c
modules/stream_out/rtp.c
+1
-2
modules/stream_out/rtsp.c
modules/stream_out/rtsp.c
+2
-3
src/libvlc-module.c
src/libvlc-module.c
+27
-0
src/missing.c
src/missing.c
+5
-6
src/network/httpd.c
src/network/httpd.c
+18
-20
No files found.
include/vlc_httpd.h
View file @
7656b8c5
...
...
@@ -99,9 +99,9 @@ struct httpd_message_t
};
/* create a new host */
VLC_API
httpd_host_t
*
vlc_http_HostNew
(
vlc_object_t
*
,
int
)
VLC_USED
;
VLC_API
httpd_host_t
*
vlc_https_HostNew
(
vlc_object_t
*
,
int
)
VLC_USED
;
VLC_API
httpd_host_t
*
vlc_rtsp_HostNew
(
vlc_object_t
*
,
int
)
VLC_USED
;
VLC_API
httpd_host_t
*
vlc_http_HostNew
(
vlc_object_t
*
)
VLC_USED
;
VLC_API
httpd_host_t
*
vlc_https_HostNew
(
vlc_object_t
*
)
VLC_USED
;
VLC_API
httpd_host_t
*
vlc_rtsp_HostNew
(
vlc_object_t
*
)
VLC_USED
;
/* delete a host */
VLC_API
void
httpd_HostDelete
(
httpd_host_t
*
);
...
...
modules/access/dvb/http.c
View file @
7656b8c5
...
...
@@ -64,8 +64,7 @@ static int HttpCallback( httpd_file_sys_t *p_args,
int
HTTPOpen
(
access_t
*
p_access
)
{
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
char
*
psz_address
,
*
psz_user
=
NULL
,
*
psz_password
=
NULL
;
int
i_port
=
0
;
char
*
psz_user
=
NULL
,
*
psz_password
=
NULL
;
char
psz_tmp
[
10
];
httpd_file_sys_t
*
f
;
...
...
@@ -74,33 +73,9 @@ int HTTPOpen( access_t *p_access )
p_sys
->
b_request_frontend_info
=
p_sys
->
b_request_mmi_info
=
false
;
p_sys
->
i_httpd_timeout
=
0
;
psz_address
=
var_GetNonEmptyString
(
p_access
,
"dvb-http-host"
);
if
(
psz_address
!=
NULL
)
{
char
*
psz_parser
=
strchr
(
psz_address
,
':'
);
if
(
psz_parser
)
{
*
psz_parser
++
=
'\0'
;
i_port
=
atoi
(
psz_parser
);
}
}
else
return
VLC_SUCCESS
;
if
(
i_port
<=
0
)
i_port
=
8082
;
/* Ugly hack to allow to run several HTTP servers on different ports. */
sprintf
(
psz_tmp
,
":%d"
,
i_port
+
1
);
config_PutPsz
(
p_access
,
"dvb-http-host"
,
psz_tmp
);
msg_Dbg
(
p_access
,
"base %d"
,
i_port
);
p_sys
->
p_httpd_host
=
vlc_http_HostNew
(
VLC_OBJECT
(
p_access
),
i_port
);
p_sys
->
p_httpd_host
=
vlc_http_HostNew
(
VLC_OBJECT
(
p_access
)
);
if
(
p_sys
->
p_httpd_host
==
NULL
)
{
msg_Err
(
p_access
,
"cannot listen on port %d"
,
i_port
);
free
(
psz_address
);
return
VLC_EGENERIC
;
}
free
(
psz_address
);
...
...
modules/access_output/http.c
View file @
7656b8c5
...
...
@@ -134,10 +134,6 @@ static int Open( vlc_object_t *p_this )
sout_access_out_t
*
p_access
=
(
sout_access_out_t
*
)
p_this
;
sout_access_out_sys_t
*
p_sys
;
char
*
psz_parser
;
char
*
psz_bind_addr
;
int
i_bind_port
;
char
*
psz_file_name
;
char
*
psz_user
;
char
*
psz_pwd
;
...
...
@@ -149,54 +145,26 @@ static int Open( vlc_object_t *p_this )
config_ChainParse
(
p_access
,
SOUT_CFG_PREFIX
,
ppsz_sout_options
,
p_access
->
p_cfg
);
/* p_access->psz_path = ":port/filename" */
psz_bind_addr
=
strdup
(
p_access
->
psz_path
);
i_bind_port
=
0
;
psz_parser
=
strchr
(
psz_bind_addr
,
'/'
);
/* Skip everything before / - backward compatibiltiy with VLC 1.1 */
const
char
*
psz_parser
=
strchr
(
p_access
->
psz_path
,
'/'
);
if
(
psz_parser
)
{
psz_file_name
=
strdup
(
psz_parser
);
*
psz_parser
=
'\0'
;
}
else
psz_file_name
=
strdup
(
"/"
);
psz_parser
=
strrchr
(
psz_bind_addr
,
':'
);
if
(
psz_parser
)
{
*
psz_parser
=
'\0'
;
i_bind_port
=
atoi
(
psz_parser
+
1
);
}
psz_parser
=
psz_bind_addr
;
/* TLS support */
if
(
p_access
->
psz_access
&&
!
strcmp
(
p_access
->
psz_access
,
"https"
)
)
{
if
(
i_bind_port
<=
0
)
i_bind_port
=
DEFAULT_SSL_PORT
;
p_sys
->
p_httpd_host
=
vlc_https_HostNew
(
VLC_OBJECT
(
p_access
),
i_bind_port
);
}
p_sys
->
p_httpd_host
=
vlc_https_HostNew
(
VLC_OBJECT
(
p_access
)
);
else
{
if
(
i_bind_port
<=
0
)
i_bind_port
=
DEFAULT_PORT
;
p_sys
->
p_httpd_host
=
vlc_http_HostNew
(
VLC_OBJECT
(
p_access
),
i_bind_port
);
}
p_sys
->
p_httpd_host
=
vlc_http_HostNew
(
VLC_OBJECT
(
p_access
)
);
if
(
p_sys
->
p_httpd_host
==
NULL
)
{
msg_Err
(
p_access
,
"cannot listen on %s port %d"
,
psz_bind_addr
,
i_bind_port
);
msg_Err
(
p_access
,
"cannot start HTTP server"
);
free
(
psz_file_name
);
free
(
psz_parser
);
free
(
p_sys
);
return
VLC_EGENERIC
;
}
free
(
psz_parser
);
psz_user
=
var_GetNonEmptyString
(
p_access
,
SOUT_CFG_PREFIX
"user"
);
psz_pwd
=
var_GetNonEmptyString
(
p_access
,
SOUT_CFG_PREFIX
"pwd"
);
...
...
modules/lua/libs/httpd.c
View file @
7656b8c5
...
...
@@ -68,10 +68,9 @@ static const luaL_Reg vlclua_httpd_reg[] = {
static
int
vlclua_httpd_tls_host_new
(
lua_State
*
L
)
{
vlc_object_t
*
p_this
=
vlclua_get_this
(
L
);
int
i_port
=
luaL_checkint
(
L
,
2
);
httpd_host_t
*
p_host
=
vlc_http_HostNew
(
p_this
,
i_port
);
httpd_host_t
*
p_host
=
vlc_http_HostNew
(
p_this
);
if
(
!
p_host
)
return
luaL_error
(
L
,
"Failed to create HTTP
port %d
\"
"
,
i_port
);
return
luaL_error
(
L
,
"Failed to create HTTP
host"
);
httpd_host_t
**
pp_host
=
lua_newuserdata
(
L
,
sizeof
(
httpd_host_t
*
)
);
*
pp_host
=
p_host
;
...
...
modules/misc/rtsp.c
View file @
7656b8c5
...
...
@@ -263,7 +263,7 @@ static int Open( vlc_object_t *p_this )
p_sys
->
psz_raw_mux
=
var_CreateGetString
(
p_this
,
"rtsp-raw-mux"
);
p_sys
->
p_rtsp_host
=
vlc_rtsp_HostNew
(
VLC_OBJECT
(
p_vod
)
,
554
);
p_sys
->
p_rtsp_host
=
vlc_rtsp_HostNew
(
VLC_OBJECT
(
p_vod
)
);
if
(
!
p_sys
->
p_rtsp_host
)
{
msg_Err
(
p_vod
,
"cannot create RTSP server"
);
...
...
modules/stream_out/rtp.c
View file @
7656b8c5
...
...
@@ -1320,8 +1320,7 @@ static int HttpSetup( sout_stream_t *p_stream, const vlc_url_t *url)
{
sout_stream_sys_t
*
p_sys
=
p_stream
->
p_sys
;
p_sys
->
p_httpd_host
=
vlc_http_HostNew
(
VLC_OBJECT
(
p_stream
),
url
->
i_port
>
0
?
url
->
i_port
:
80
);
p_sys
->
p_httpd_host
=
vlc_http_HostNew
(
VLC_OBJECT
(
p_stream
)
);
if
(
p_sys
->
p_httpd_host
)
{
p_sys
->
p_httpd_file
=
httpd_FileNew
(
p_sys
->
p_httpd_host
,
...
...
modules/stream_out/rtsp.c
View file @
7656b8c5
...
...
@@ -111,14 +111,13 @@ rtsp_stream_t *RtspSetup( vlc_object_t *owner, vod_media_t *media,
goto
error
;
}
int
port
=
(
url
->
i_port
>
0
)
?
url
->
i_port
:
554
;
rtsp
->
psz_path
=
strdup
(
(
url
->
psz_path
!=
NULL
)
?
url
->
psz_path
:
"/"
);
if
(
rtsp
->
psz_path
==
NULL
)
goto
error
;
msg_Dbg
(
owner
,
"RTSP stream
: port %d at %s"
,
port
,
rtsp
->
psz_path
);
msg_Dbg
(
owner
,
"RTSP stream
at %s"
,
rtsp
->
psz_path
);
rtsp
->
host
=
vlc_rtsp_HostNew
(
VLC_OBJECT
(
owner
)
,
port
);
rtsp
->
host
=
vlc_rtsp_HostNew
(
VLC_OBJECT
(
owner
)
);
if
(
rtsp
->
host
==
NULL
)
goto
error
;
...
...
src/libvlc-module.c
View file @
7656b8c5
...
...
@@ -896,6 +896,27 @@ static const char *const ppsz_clock_descriptions[] =
"Specify an IP address (e.g. ::1 or 127.0.0.1) or a host name " \
"(e.g. localhost) to restrict them to a specific network interface." )
#define HTTP_PORT_TEXT N_( "HTTP server port" )
#define HTTP_PORT_LONGTEXT N_( \
"The HTTP server will listen on this TCP port. " \
"The standard HTTP port number is 80. " \
"However allocation of port numbers below 1025 is usually restricted " \
"by the operating system." )
#define HTTPS_PORT_TEXT N_( "HTTPS server port" )
#define HTTPS_PORT_LONGTEXT N_( \
"The HTTPS server will listen on this TCP port. " \
"The standard HTTPS port number is 443. " \
"However allocation of port numbers below 1025 is usually restricted " \
"by the operating system." )
#define RTSP_PORT_TEXT N_( "RTSP server port" )
#define RTSP_PORT_LONGTEXT N_( \
"The HTTPS server will listen on this TCP port. " \
"The standard RTSP port number is 554. " \
"However allocation of port numbers below 1025 is usually restricted " \
"by the operating system." )
#define HTTP_CERT_TEXT N_("HTTP/TLS server certificate")
#define CERT_LONGTEXT N_( \
"This X.509 certicate file (PEM format) is used for server-side TLS." )
...
...
@@ -1907,7 +1928,13 @@ vlc_module_begin ()
TIMEOUT_LONGTEXT
,
true
)
add_string
(
"http-host"
,
NULL
,
HTTP_HOST_TEXT
,
HOST_LONGTEXT
,
true
)
add_integer
(
"http-port"
,
8080
,
HTTP_PORT_TEXT
,
HTTP_PORT_LONGTEXT
,
true
)
change_integer_range
(
1
,
65535
)
add_integer
(
"https-port"
,
8443
,
HTTPS_PORT_TEXT
,
HTTPS_PORT_LONGTEXT
,
true
)
change_integer_range
(
1
,
65535
)
add_string
(
"rtsp-host"
,
NULL
,
RTSP_HOST_TEXT
,
HOST_LONGTEXT
,
true
)
add_integer
(
"rtsp-port"
,
5554
,
RTSP_PORT_TEXT
,
RTSP_PORT_LONGTEXT
,
true
)
change_integer_range
(
1
,
65535
)
add_loadfile
(
"http-cert"
,
NULL
,
HTTP_CERT_TEXT
,
CERT_LONGTEXT
,
true
)
add_deprecated_alias
(
"sout-http-cert"
)
/* since 1.2.0 */
add_loadfile
(
"http-key"
,
NULL
,
HTTP_KEY_TEXT
,
KEY_LONGTEXT
,
true
)
...
...
src/missing.c
View file @
7656b8c5
...
...
@@ -93,21 +93,20 @@ void httpd_HostDelete (httpd_host_t *h)
assert
(
0
);
}
httpd_host_t
*
vlc_http_HostNew
(
vlc_object_t
*
obj
,
int
port
)
httpd_host_t
*
vlc_http_HostNew
(
vlc_object_t
*
obj
)
{
(
void
)
port
;
msg_Err
(
obj
,
"HTTP server not compiled-in!"
);
return
NULL
;
}
httpd_host_t
*
vlc_https_HostNew
(
vlc_object_t
*
obj
,
int
port
)
httpd_host_t
*
vlc_https_HostNew
(
vlc_object_t
*
obj
)
{
return
httpd_HostNew
(
obj
,
port
);
msg_Err
(
obj
,
"HTTPS server not compiled-in!"
);
return
NULL
;
}
httpd_host_t
*
vlc_rtsp_HostNew
(
vlc_object_t
*
obj
,
int
port
)
httpd_host_t
*
vlc_rtsp_HostNew
(
vlc_object_t
*
obj
)
{
(
void
)
port
;
msg_Err
(
obj
,
"RTSP server not compiled-in!"
);
return
NULL
;
}
...
...
src/network/httpd.c
View file @
7656b8c5
...
...
@@ -88,7 +88,6 @@ struct httpd_host_t
unsigned
i_ref
;
/* address/port and socket for listening at connections */
int
i_port
;
int
*
fds
;
unsigned
nfd
;
...
...
@@ -963,16 +962,16 @@ void httpd_StreamDelete( httpd_stream_t *stream )
* Low level
*****************************************************************************/
static
void
*
httpd_HostThread
(
void
*
);
static
httpd_host_t
*
httpd_HostCreate
(
vlc_object_t
*
,
const
char
*
,
int
,
vlc_tls_creds_t
*
);
static
httpd_host_t
*
httpd_HostCreate
(
vlc_object_t
*
,
const
char
*
,
const
char
*
,
vlc_tls_creds_t
*
);
/* create a new host */
httpd_host_t
*
vlc_http_HostNew
(
vlc_object_t
*
p_this
,
int
i_port
)
httpd_host_t
*
vlc_http_HostNew
(
vlc_object_t
*
p_this
)
{
return
httpd_HostCreate
(
p_this
,
"http-host"
,
i_port
,
NULL
);
return
httpd_HostCreate
(
p_this
,
"http-host"
,
"http-port"
,
NULL
);
}
httpd_host_t
*
vlc_https_HostNew
(
vlc_object_t
*
obj
,
int
port
)
httpd_host_t
*
vlc_https_HostNew
(
vlc_object_t
*
obj
)
{
char
*
cert
=
var_InheritString
(
obj
,
"http-cert"
);
if
(
cert
==
NULL
)
...
...
@@ -1019,22 +1018,23 @@ httpd_host_t *vlc_https_HostNew( vlc_object_t *obj, int port )
free
(
crl
);
}
return
httpd_HostCreate
(
obj
,
"http-host"
,
port
,
tls
);
return
httpd_HostCreate
(
obj
,
"http-host"
,
"https-port"
,
tls
);
error:
vlc_tls_ServerDelete
(
tls
);
return
NULL
;
}
httpd_host_t
*
vlc_rtsp_HostNew
(
vlc_object_t
*
p_this
,
int
i_port
)
httpd_host_t
*
vlc_rtsp_HostNew
(
vlc_object_t
*
p_this
)
{
return
httpd_HostCreate
(
p_this
,
"rtsp-host"
,
i_port
,
NULL
);
return
httpd_HostCreate
(
p_this
,
"rtsp-host"
,
"rtsp-port"
,
NULL
);
}
static
vlc_mutex_t
httpd_mutex
=
VLC_STATIC_MUTEX
;
static
httpd_host_t
*
httpd_HostCreate
(
vlc_object_t
*
p_this
,
const
char
*
hostvar
,
int
i_port
,
const
char
*
hostvar
,
const
char
*
portvar
,
vlc_tls_creds_t
*
p_tls
)
{
httpd_t
*
httpd
;
...
...
@@ -1068,8 +1068,7 @@ static httpd_host_t *httpd_HostCreate( vlc_object_t *p_this,
host
=
httpd
->
host
[
i
];
/* cannot mix TLS and non-TLS hosts */
if
(
(
(
httpd
->
host
[
i
]
->
p_tls
!=
NULL
)
!=
(
p_tls
!=
NULL
)
)
||
(
host
->
i_port
!=
i_port
)
)
if
(
(
httpd
->
host
[
i
]
->
p_tls
!=
NULL
)
!=
(
p_tls
!=
NULL
)
)
continue
;
/* Increase existing matching host reference count.
...
...
@@ -1100,7 +1099,8 @@ static httpd_host_t *httpd_HostCreate( vlc_object_t *p_this,
host
->
i_ref
=
1
;
char
*
hostname
=
var_InheritString
(
p_this
->
p_libvlc
,
hostvar
);
host
->
fds
=
net_ListenTCP
(
p_this
,
hostname
,
i_port
);
int
port
=
var_InheritInteger
(
p_this
->
p_libvlc
,
portvar
);
host
->
fds
=
net_ListenTCP
(
p_this
,
hostname
,
port
);
free
(
hostname
);
if
(
host
->
fds
==
NULL
)
{
...
...
@@ -1115,12 +1115,10 @@ static httpd_host_t *httpd_HostCreate( vlc_object_t *p_this,
goto
error
;
}
host
->
i_port
=
i_port
;
host
->
i_url
=
0
;
host
->
url
=
NULL
;
host
->
i_client
=
0
;
host
->
client
=
NULL
;
host
->
p_tls
=
p_tls
;
/* create the thread */
...
...
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