Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
6e1e9caa
Commit
6e1e9caa
authored
20 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
Based on Gisle Vanem's patch: make sure the directory re-use works even when
a URL-encoded path is used.
parent
f71725de
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/ftp.c
+19
-7
19 additions, 7 deletions
lib/ftp.c
with
19 additions
and
7 deletions
lib/ftp.c
+
19
−
7
View file @
6e1e9caa
...
...
@@ -765,23 +765,29 @@ CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status)
bool
was_ctl_valid
=
ftp
->
ctl_valid
;
size_t
flen
;
size_t
dlen
;
char
*
path
;
/* now store a copy of the directory we are in */
if
(
ftp
->
prevpath
)
free
(
ftp
->
prevpath
);
flen
=
ftp
->
file
?
strlen
(
ftp
->
file
)
:
0
;
dlen
=
conn
->
path
?
strlen
(
conn
->
path
)
-
flen
:
0
;
path
=
curl_unescape
(
conn
->
path
,
0
);
/* get the "raw" path */
if
(
!
path
)
CURLE_OUT_OF_MEMORY
;
flen
=
ftp
->
file
?
strlen
(
ftp
->
file
)
:
0
;
/* file is "raw" already */
dlen
=
strlen
(
path
)
-
flen
;
if
(
dlen
)
{
ftp
->
prevpath
=
malloc
(
dlen
+
1
);
if
(
!
ftp
->
prevpath
)
return
CURLE_OUT_OF_MEMORY
;
memcpy
(
ftp
->
prevpath
,
conn
->
path
,
dlen
);
memcpy
(
ftp
->
prevpath
,
path
,
dlen
);
ftp
->
prevpath
[
dlen
]
=
0
;
/* terminate */
infof
(
data
,
"Remembering we are in dir %s
\n
"
,
ftp
->
prevpath
);
}
else
ftp
->
prevpath
=
NULL
;
/* no path */
free
(
path
);
/* free the dir tree and file parts */
freedirs
(
ftp
);
...
...
@@ -2771,14 +2777,20 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
ftp
->
cwddone
=
FALSE
;
/* default to not done */
dlen
=
conn
->
path
?
strlen
(
conn
->
path
)
:
0
;
if
(
dlen
&&
ftp
->
prevpath
)
{
dlen
-=
ftp
->
file
?
strlen
(
ftp
->
file
)
:
0
;
if
(
ftp
->
prevpath
)
{
/* prevpath is "raw" so we convert the input path before we compare the
strings */
char
*
path
=
curl_unescape
(
conn
->
path
,
0
);
if
(
!
path
)
return
CURLE_OUT_OF_MEMORY
;
dlen
=
strlen
(
path
)
-
(
ftp
->
file
?
strlen
(
ftp
->
file
)
:
0
);
if
((
dlen
==
strlen
(
ftp
->
prevpath
))
&&
curl_strnequal
(
conn
->
path
,
ftp
->
prevpath
,
dlen
))
{
curl_strnequal
(
path
,
ftp
->
prevpath
,
dlen
))
{
infof
(
data
,
"Request has same path as previous transfer
\n
"
);
ftp
->
cwddone
=
TRUE
;
}
free
(
path
);
}
return
retcode
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment