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
3ba6dce4
Commit
3ba6dce4
authored
Jul 03, 2014
by
Lukasz Marek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf/ftp: make response parsing more RFC compliant
Signed-off-by:
Lukasz Marek
<
lukasz.m.luki2@gmail.com
>
parent
cf8c44fc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
18 deletions
+29
-18
ftp.c
libavformat/ftp.c
+29
-18
No files found.
libavformat/ftp.c
View file @
3ba6dce4
...
...
@@ -119,7 +119,7 @@ static int ftp_get_line(FTPContext *s, char *line, int line_size)
*/
static
int
ftp_status
(
FTPContext
*
s
,
char
**
line
,
const
int
response_codes
[])
{
int
err
,
i
,
dash
=
0
,
result
=
0
,
code_found
=
0
;
int
err
,
i
,
dash
=
0
,
result
=
0
,
code_found
=
0
,
linesize
;
char
buf
[
CONTROL_BUFFER_SIZE
];
AVBPrint
line_buffer
;
...
...
@@ -135,25 +135,36 @@ static int ftp_status(FTPContext *s, char **line, const int response_codes[])
av_log
(
s
,
AV_LOG_DEBUG
,
"%s
\n
"
,
buf
);
if
(
strlen
(
buf
)
<
4
)
continue
;
linesize
=
strlen
(
buf
);
err
=
0
;
for
(
i
=
0
;
i
<
3
;
++
i
)
{
if
(
buf
[
i
]
<
'0'
||
buf
[
i
]
>
'9'
)
continue
;
err
*=
10
;
err
+=
buf
[
i
]
-
'0'
;
if
(
linesize
>=
3
)
{
for
(
i
=
0
;
i
<
3
;
++
i
)
{
if
(
buf
[
i
]
<
'0'
||
buf
[
i
]
>
'9'
)
{
err
=
0
;
break
;
}
err
*=
10
;
err
+=
buf
[
i
]
-
'0'
;
}
}
dash
=
!!
(
buf
[
3
]
==
'-'
);
for
(
i
=
0
;
response_codes
[
i
];
++
i
)
{
if
(
err
==
response_codes
[
i
])
{
if
(
line
)
av_bprintf
(
&
line_buffer
,
"%s"
,
buf
);
code_found
=
1
;
result
=
err
;
break
;
if
(
!
code_found
)
{
for
(
i
=
0
;
response_codes
[
i
];
++
i
)
{
if
(
err
==
response_codes
[
i
])
{
code_found
=
1
;
result
=
err
;
break
;
}
}
}
if
(
code_found
)
{
if
(
line
)
av_bprintf
(
&
line_buffer
,
"%s
\r\n
"
,
buf
);
if
(
linesize
>=
4
)
{
if
(
!
dash
&&
buf
[
3
]
==
'-'
)
dash
=
err
;
else
if
(
err
==
dash
&&
buf
[
3
]
==
' '
)
dash
=
0
;
}
}
}
...
...
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