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
de8438c3
Commit
de8438c3
authored
Aug 02, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
httpd_ServerIP(): return server port too
parent
0af9a41a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
35 deletions
+32
-35
include/vlc_httpd.h
include/vlc_httpd.h
+2
-2
modules/misc/rtsp.c
modules/misc/rtsp.c
+11
-12
modules/stream_out/rtsp.c
modules/stream_out/rtsp.c
+9
-11
src/missing.c
src/missing.c
+4
-4
src/network/httpd.c
src/network/httpd.c
+6
-6
No files found.
include/vlc_httpd.h
View file @
de8438c3
...
...
@@ -117,8 +117,8 @@ VLC_API void httpd_UrlDelete( httpd_url_t * );
/* Default client mode is FILE, use these to change it */
VLC_API
void
httpd_ClientModeStream
(
httpd_client_t
*
cl
);
VLC_API
void
httpd_ClientModeBidir
(
httpd_client_t
*
cl
);
VLC_API
char
*
httpd_ClientIP
(
const
httpd_client_t
*
cl
,
char
*
psz_ip
);
VLC_API
char
*
httpd_ServerIP
(
const
httpd_client_t
*
cl
,
char
*
psz_ip
);
VLC_API
char
*
httpd_ClientIP
(
const
httpd_client_t
*
cl
,
char
*
,
int
*
);
VLC_API
char
*
httpd_ServerIP
(
const
httpd_client_t
*
cl
,
char
*
,
int
*
);
/* High level */
...
...
modules/misc/rtsp.c
View file @
de8438c3
...
...
@@ -164,7 +164,6 @@ struct vod_sys_t
{
/* RTSP server */
httpd_host_t
*
p_rtsp_host
;
int
i_port
;
int
i_throttle_users
;
int
i_connections
;
...
...
@@ -271,8 +270,6 @@ static int Open( vlc_object_t *p_this )
goto
error
;
}
p_sys
->
i_port
=
554
;
TAB_INIT
(
p_sys
->
i_media
,
p_sys
->
media
);
p_sys
->
i_media_id
=
0
;
...
...
@@ -373,8 +370,8 @@ static vod_media_t *MediaNew( vod_t *p_vod, const char *psz_name,
msg_Dbg
(
p_vod
,
"created RTSP url: %s"
,
p_media
->
psz_rtsp_path
);
if
(
asprintf
(
&
p_media
->
psz_rtsp_control_v4
,
"rtsp://%%s:
%d%s/trackID=%%d"
,
p_sys
->
i_port
,
p_media
->
psz_rtsp_path
)
<
0
)
"rtsp://%%s:%
%d%s/trackID=%%d"
,
p_media
->
psz_rtsp_path
)
<
0
)
{
httpd_UrlDelete
(
p_media
->
p_rtsp_url
);
free
(
p_media
->
psz_rtsp_path
);
...
...
@@ -382,8 +379,8 @@ static vod_media_t *MediaNew( vod_t *p_vod, const char *psz_name,
return
NULL
;
}
if
(
asprintf
(
&
p_media
->
psz_rtsp_control_v6
,
"rtsp://[%%s]:
%d%s/trackID=%%d"
,
p_sys
->
i_port
,
p_media
->
psz_rtsp_path
)
<
0
)
"rtsp://[%%s]:%
%d%s/trackID=%%d"
,
p_media
->
psz_rtsp_path
)
<
0
)
{
httpd_UrlDelete
(
p_media
->
p_rtsp_url
);
free
(
p_media
->
psz_rtsp_path
);
...
...
@@ -402,6 +399,7 @@ static vod_media_t *MediaNew( vod_t *p_vod, const char *psz_name,
httpd_UrlCatch
(
p_media
->
p_rtsp_url
,
HTTPD_MSG_GETPARAMETER
,
RtspCallback
,
(
void
*
)
p_media
);
httpd_UrlCatch
(
p_media
->
p_rtsp_url
,
HTTPD_MSG_TEARDOWN
,
RtspCallback
,
(
void
*
)
p_media
);
p_media
->
p_vod
=
p_vod
;
...
...
@@ -965,7 +963,7 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
p_media
->
b_raw
=
true
;
}
if
(
httpd_ClientIP
(
cl
,
ip
)
==
NULL
)
if
(
httpd_ClientIP
(
cl
,
ip
,
NULL
)
==
NULL
)
{
answer
->
i_status
=
500
;
answer
->
i_body
=
0
;
...
...
@@ -1121,7 +1119,7 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
break
;
}
if
(
httpd_ClientIP
(
cl
,
ip
)
==
NULL
)
break
;
if
(
httpd_ClientIP
(
cl
,
ip
,
NULL
)
==
NULL
)
break
;
p_rtsp
->
b_playing
=
true
;
...
...
@@ -1291,7 +1289,7 @@ static int RtspCallbackES( httpd_callback_sys_t *p_args, httpd_client_t *cl,
int
i_port
=
atoi
(
strstr
(
psz_transport
,
"client_port="
)
+
strlen
(
"client_port="
)
);
if
(
httpd_ClientIP
(
cl
,
ip
)
==
NULL
)
if
(
httpd_ClientIP
(
cl
,
ip
,
NULL
)
==
NULL
)
{
answer
->
i_status
=
500
;
answer
->
i_body
=
0
;
...
...
@@ -1489,8 +1487,9 @@ static char *SDPGenerate( const vod_media_t *p_media, httpd_client_t *cl )
{
char
*
psz_sdp
,
ip
[
NI_MAXNUMERICHOST
];
const
char
*
psz_control
;
int
port
;
if
(
httpd_ServerIP
(
cl
,
ip
)
==
NULL
)
if
(
httpd_ServerIP
(
cl
,
ip
,
&
port
)
==
NULL
)
return
NULL
;
bool
ipv6
=
(
strchr
(
ip
,
':'
)
!=
NULL
);
...
...
@@ -1545,7 +1544,7 @@ static char *SDPGenerate( const vod_media_t *p_media, httpd_client_t *cl )
p_es
->
psz_ptname
,
p_es
->
i_clock_rate
,
p_es
->
i_channels
,
p_es
->
psz_fmtp
);
sdp_AddAttribute
(
&
psz_sdp
,
"control"
,
psz_control
,
ip
,
i
);
sdp_AddAttribute
(
&
psz_sdp
,
"control"
,
psz_control
,
ip
,
port
,
i
);
}
return
psz_sdp
;
...
...
modules/stream_out/rtsp.c
View file @
de8438c3
...
...
@@ -64,7 +64,6 @@ struct rtsp_stream_t
httpd_url_t
*
url
;
char
*
psz_path
;
unsigned
track_id
;
unsigned
port
;
int
sessionc
;
rtsp_session_t
**
sessionv
;
...
...
@@ -112,14 +111,14 @@ rtsp_stream_t *RtspSetup( vlc_object_t *owner, vod_media_t *media,
goto
error
;
}
rtsp
->
port
=
(
url
->
i_port
>
0
)
?
url
->
i_port
:
554
;
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"
,
rtsp
->
port
,
rtsp
->
psz_path
);
msg_Dbg
(
owner
,
"RTSP stream: port %d at %s"
,
port
,
rtsp
->
psz_path
);
rtsp
->
host
=
vlc_rtsp_HostNew
(
VLC_OBJECT
(
owner
),
rtsp
->
port
);
rtsp
->
host
=
vlc_rtsp_HostNew
(
VLC_OBJECT
(
owner
),
port
);
if
(
rtsp
->
host
==
NULL
)
goto
error
;
...
...
@@ -617,18 +616,17 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id,
{
/* Build self-referential control URL */
char
ip
[
NI_MAXNUMERICHOST
],
*
ptr
;
int
port
;
httpd_ServerIP
(
cl
,
ip
);
httpd_ServerIP
(
cl
,
ip
,
&
port
);
ptr
=
strchr
(
ip
,
'%'
);
if
(
ptr
!=
NULL
)
*
ptr
=
'\0'
;
if
(
strchr
(
ip
,
':'
)
!=
NULL
)
sprintf
(
control
,
"rtsp://[%s]:%u%s"
,
ip
,
rtsp
->
port
,
rtsp
->
psz_path
);
sprintf
(
control
,
"rtsp://[%s]:%d%s"
,
ip
,
port
,
rtsp
->
psz_path
);
else
sprintf
(
control
,
"rtsp://%s:%u%s"
,
ip
,
rtsp
->
port
,
rtsp
->
psz_path
);
sprintf
(
control
,
"rtsp://%s:%d%s"
,
ip
,
port
,
rtsp
->
psz_path
);
}
/* */
...
...
@@ -809,7 +807,7 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id,
int
fd
,
sport
;
uint32_t
ssrc
;
if
(
httpd_ClientIP
(
cl
,
ip
)
==
NULL
)
if
(
httpd_ClientIP
(
cl
,
ip
,
NULL
)
==
NULL
)
{
answer
->
i_status
=
500
;
continue
;
...
...
@@ -902,7 +900,7 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id,
}
vlc_mutex_unlock
(
&
rtsp
->
lock
);
httpd_ServerIP
(
cl
,
ip
);
httpd_ServerIP
(
cl
,
ip
,
NULL
);
/* Specify source IP only if it is different from the
* RTSP control connection server address */
...
...
src/missing.c
View file @
de8438c3
...
...
@@ -32,9 +32,9 @@
#ifndef ENABLE_HTTPD
# include <vlc_httpd.h>
char
*
httpd_ClientIP
(
const
httpd_client_t
*
cl
,
char
*
psz_ip
)
char
*
httpd_ClientIP
(
const
httpd_client_t
*
cl
,
char
*
psz_ip
,
int
*
port
)
{
(
void
)
cl
;
(
void
)
psz_ip
;
(
void
)
cl
;
(
void
)
psz_ip
;
(
void
)
port
assert
(
0
);
}
...
...
@@ -137,9 +137,9 @@ httpd_redirect_t *httpd_RedirectNew (httpd_host_t *host,
assert
(
0
);
}
char
*
httpd_ServerIP
(
const
httpd_client_t
*
client
,
char
*
ip
)
char
*
httpd_ServerIP
(
const
httpd_client_t
*
client
,
char
*
ip
,
int
*
port
)
{
(
void
)
client
;
(
void
)
ip
;
(
void
)
client
;
(
void
)
ip
;
(
void
)
port
;
assert
(
0
);
}
...
...
src/network/httpd.c
View file @
de8438c3
...
...
@@ -533,7 +533,7 @@ httpd_HandlerCallBack( httpd_callback_sys_t *p_sys, httpd_client_t *cl,
/* We do it ourselves, thanks */
answer
->
i_status
=
0
;
if
(
httpd_ClientIP
(
cl
,
psz_remote_addr
)
==
NULL
)
if
(
httpd_ClientIP
(
cl
,
psz_remote_addr
,
NULL
)
==
NULL
)
*
psz_remote_addr
=
'\0'
;
uint8_t
*
psz_args
=
query
->
psz_args
;
...
...
@@ -1434,14 +1434,14 @@ void httpd_ClientModeBidir( httpd_client_t *cl )
cl
->
i_mode
=
HTTPD_CLIENT_BIDIR
;
}
char
*
httpd_ClientIP
(
const
httpd_client_t
*
cl
,
char
*
psz_ip
)
char
*
httpd_ClientIP
(
const
httpd_client_t
*
cl
,
char
*
ip
,
int
*
port
)
{
return
net_GetPeerAddress
(
cl
->
fd
,
psz_ip
,
NULL
)
?
NULL
:
psz_
ip
;
return
net_GetPeerAddress
(
cl
->
fd
,
ip
,
port
)
?
NULL
:
ip
;
}
char
*
httpd_ServerIP
(
const
httpd_client_t
*
cl
,
char
*
psz_ip
)
char
*
httpd_ServerIP
(
const
httpd_client_t
*
cl
,
char
*
ip
,
int
*
port
)
{
return
net_GetSockAddress
(
cl
->
fd
,
psz_ip
,
NULL
)
?
NULL
:
psz_
ip
;
return
net_GetSockAddress
(
cl
->
fd
,
ip
,
port
)
?
NULL
:
ip
;
}
static
void
httpd_ClientClean
(
httpd_client_t
*
cl
)
...
...
@@ -2259,7 +2259,7 @@ static void* httpd_HostThread( void *data )
{
char
ip
[
NI_MAXNUMERICHOST
];
if
(
(
httpd_ClientIP
(
cl
,
ip
)
==
NULL
)
if
(
(
httpd_ClientIP
(
cl
,
ip
,
NULL
)
==
NULL
)
||
ACL_Check
(
url
->
p_acl
,
ip
)
)
{
b_hosts_failed
=
true
;
...
...
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