Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
ec7c51c7
Commit
ec7c51c7
authored
Jun 15, 2013
by
Luca Barbato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avf: move ff_http_match_no_proxy to network
It is only used by network protocols.
parent
afc86853
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
57 deletions
+57
-57
internal.h
libavformat/internal.h
+0
-2
network.c
libavformat/network.c
+54
-0
network.h
libavformat/network.h
+2
-0
noproxy-test.c
libavformat/noproxy-test.c
+1
-1
utils.c
libavformat/utils.c
+0
-54
No files found.
libavformat/internal.h
View file @
ec7c51c7
...
@@ -375,6 +375,4 @@ enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag);
...
@@ -375,6 +375,4 @@ enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag);
*/
*/
enum
AVCodecID
ff_get_pcm_codec_id
(
int
bps
,
int
flt
,
int
be
,
int
sflags
);
enum
AVCodecID
ff_get_pcm_codec_id
(
int
bps
,
int
flt
,
int
be
,
int
sflags
);
int
ff_http_match_no_proxy
(
const
char
*
no_proxy
,
const
char
*
hostname
);
#endif
/* AVFORMAT_INTERNAL_H */
#endif
/* AVFORMAT_INTERNAL_H */
libavformat/network.c
View file @
ec7c51c7
...
@@ -277,3 +277,57 @@ int ff_listen_connect(int fd, const struct sockaddr *addr,
...
@@ -277,3 +277,57 @@ int ff_listen_connect(int fd, const struct sockaddr *addr,
}
}
return
ret
;
return
ret
;
}
}
static
int
match_host_pattern
(
const
char
*
pattern
,
const
char
*
hostname
)
{
int
len_p
,
len_h
;
if
(
!
strcmp
(
pattern
,
"*"
))
return
1
;
// Skip a possible *. at the start of the pattern
if
(
pattern
[
0
]
==
'*'
)
pattern
++
;
if
(
pattern
[
0
]
==
'.'
)
pattern
++
;
len_p
=
strlen
(
pattern
);
len_h
=
strlen
(
hostname
);
if
(
len_p
>
len_h
)
return
0
;
// Simply check if the end of hostname is equal to 'pattern'
if
(
!
strcmp
(
pattern
,
&
hostname
[
len_h
-
len_p
]))
{
if
(
len_h
==
len_p
)
return
1
;
// Exact match
if
(
hostname
[
len_h
-
len_p
-
1
]
==
'.'
)
return
1
;
// The matched substring is a domain and not just a substring of a domain
}
return
0
;
}
int
ff_http_match_no_proxy
(
const
char
*
no_proxy
,
const
char
*
hostname
)
{
char
*
buf
,
*
start
;
int
ret
=
0
;
if
(
!
no_proxy
)
return
0
;
if
(
!
hostname
)
return
0
;
buf
=
av_strdup
(
no_proxy
);
if
(
!
buf
)
return
0
;
start
=
buf
;
while
(
start
)
{
char
*
sep
,
*
next
=
NULL
;
start
+=
strspn
(
start
,
" ,"
);
sep
=
start
+
strcspn
(
start
,
" ,"
);
if
(
*
sep
)
{
next
=
sep
+
1
;
*
sep
=
'\0'
;
}
if
(
match_host_pattern
(
start
,
hostname
))
{
ret
=
1
;
break
;
}
start
=
next
;
}
av_free
(
buf
);
return
ret
;
}
libavformat/network.h
View file @
ec7c51c7
...
@@ -244,4 +244,6 @@ int ff_listen_connect(int fd, const struct sockaddr *addr,
...
@@ -244,4 +244,6 @@ int ff_listen_connect(int fd, const struct sockaddr *addr,
socklen_t
addrlen
,
int
timeout
,
socklen_t
addrlen
,
int
timeout
,
URLContext
*
h
);
URLContext
*
h
);
int
ff_http_match_no_proxy
(
const
char
*
no_proxy
,
const
char
*
hostname
);
#endif
/* AVFORMAT_NETWORK_H */
#endif
/* AVFORMAT_NETWORK_H */
libavformat/noproxy-test.c
View file @
ec7c51c7
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
*/
#include "
internal
.h"
#include "
network
.h"
static
void
test
(
const
char
*
pattern
,
const
char
*
host
)
static
void
test
(
const
char
*
pattern
,
const
char
*
host
)
{
{
...
...
libavformat/utils.c
View file @
ec7c51c7
...
@@ -3407,57 +3407,3 @@ const struct AVCodecTag *avformat_get_riff_audio_tags(void)
...
@@ -3407,57 +3407,3 @@ const struct AVCodecTag *avformat_get_riff_audio_tags(void)
{
{
return
ff_codec_wav_tags
;
return
ff_codec_wav_tags
;
}
}
static
int
match_host_pattern
(
const
char
*
pattern
,
const
char
*
hostname
)
{
int
len_p
,
len_h
;
if
(
!
strcmp
(
pattern
,
"*"
))
return
1
;
// Skip a possible *. at the start of the pattern
if
(
pattern
[
0
]
==
'*'
)
pattern
++
;
if
(
pattern
[
0
]
==
'.'
)
pattern
++
;
len_p
=
strlen
(
pattern
);
len_h
=
strlen
(
hostname
);
if
(
len_p
>
len_h
)
return
0
;
// Simply check if the end of hostname is equal to 'pattern'
if
(
!
strcmp
(
pattern
,
&
hostname
[
len_h
-
len_p
]))
{
if
(
len_h
==
len_p
)
return
1
;
// Exact match
if
(
hostname
[
len_h
-
len_p
-
1
]
==
'.'
)
return
1
;
// The matched substring is a domain and not just a substring of a domain
}
return
0
;
}
int
ff_http_match_no_proxy
(
const
char
*
no_proxy
,
const
char
*
hostname
)
{
char
*
buf
,
*
start
;
int
ret
=
0
;
if
(
!
no_proxy
)
return
0
;
if
(
!
hostname
)
return
0
;
buf
=
av_strdup
(
no_proxy
);
if
(
!
buf
)
return
0
;
start
=
buf
;
while
(
start
)
{
char
*
sep
,
*
next
=
NULL
;
start
+=
strspn
(
start
,
" ,"
);
sep
=
start
+
strcspn
(
start
,
" ,"
);
if
(
*
sep
)
{
next
=
sep
+
1
;
*
sep
=
'\0'
;
}
if
(
match_host_pattern
(
start
,
hostname
))
{
ret
=
1
;
break
;
}
start
=
next
;
}
av_free
(
buf
);
return
ret
;
}
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