New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FTP Bug: Curl sends "CWD /" despite CURLFTPMETHOD_NOCWD #1718

Closed
PeterLamare opened this Issue Aug 1, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@PeterLamare

PeterLamare commented Aug 1, 2017

Reproduce:
Set CURLFTPMETHOD_NOCWD and access different URLs reusing the same easy handle.

Consequence:
Killing the performance gain of reusing an easy handle by needless CWD round trips.

Fix:
The bug seems to be in src/lib/ftp.c ftp_parse_url_path():
it compares "ftpc->prevpath" with "data->state.path", and sets "ftpc->cwddone = TRUE" if equal.
This is obviously incorrect for CURLFTPMETHOD_NOCWD where the working directory is not set to state.path, instead it should compare "ftpc->prevpath" against ""

-Lama

@bagder

This comment has been minimized.

Member

bagder commented Aug 1, 2017

I think the condition needs an exception for CURLFTPMETHOD_NOCWD, so that the code also handles the case when the method is actually changed between two requests.

bagder added a commit that referenced this issue Aug 3, 2017

FTP: skip unnecessary CWD when in nocwd mode
... when reusing a connection. If it didn't do any CWD previously.

Fixes #1718

bagder added a commit that referenced this issue Aug 3, 2017

test1010: verify that #1718 is fixed
... by doing two transfers in nocwd mode and check that there's no
superfluous CWD command.

@bagder bagder referenced this issue Aug 3, 2017

Merged

FTP: nocwd fix #1727

@bagder bagder removed the help wanted label Aug 3, 2017

@bagder bagder closed this in #1727 Aug 4, 2017

bagder added a commit that referenced this issue Aug 4, 2017

FTP: skip unnecessary CWD when in nocwd mode
... when reusing a connection. If it didn't do any CWD previously.

Fixes #1718

bagder added a commit that referenced this issue Aug 4, 2017

test1010: verify that #1718 is fixed
... by doing two transfers in nocwd mode and check that there's no
superfluous CWD command.

@lock lock bot locked as resolved and limited conversation to collaborators May 6, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.