View | Details | Raw Unified | Return to bug 154988 | Differences between
and this patch

Collapse All | Expand All

(-)lib/libfetch/ftp.c (-2 / +23 lines)
Lines 780-786 Link Here
780
		/* make the server initiate the transfer */
780
		/* make the server initiate the transfer */
781
		if (verbose)
781
		if (verbose)
782
			fetch_info("initiating transfer");
782
			fetch_info("initiating transfer");
783
		e = ftp_cmd(conn, "%s %.*s", oper, filenamelen, filename);
783
		if (*filename != '\0')
784
			e = ftp_cmd(conn, "%s %.*s", oper,
785
			    filenamelen, filename);
786
		else
787
			e = ftp_cmd(conn, "%s", oper);
784
		if (e != FTP_CONNECTION_ALREADY_OPEN && e != FTP_OPEN_DATA_CONNECTION)
788
		if (e != FTP_CONNECTION_ALREADY_OPEN && e != FTP_OPEN_DATA_CONNECTION)
785
			goto ouch;
789
			goto ouch;
786
790
Lines 871-877 Link Here
871
		/* make the server initiate the transfer */
875
		/* make the server initiate the transfer */
872
		if (verbose)
876
		if (verbose)
873
			fetch_info("initiating transfer");
877
			fetch_info("initiating transfer");
874
		e = ftp_cmd(conn, "%s %.*s", oper, filenamelen, filename);
878
		if (*filename != '\0')
879
			e = ftp_cmd(conn, "%s %.*s", oper,
880
			    filenamelen, filename);
881
		else
882
			e = ftp_cmd(conn, "%s", oper);
875
		if (e != FTP_CONNECTION_ALREADY_OPEN && e != FTP_OPEN_DATA_CONNECTION)
883
		if (e != FTP_CONNECTION_ALREADY_OPEN && e != FTP_OPEN_DATA_CONNECTION)
876
			goto ouch;
884
			goto ouch;
877
885
Lines 1105-1110 Link Here
1105
{
1113
{
1106
	conn_t *conn;
1114
	conn_t *conn;
1107
	int oflag;
1115
	int oflag;
1116
	char *cp;
1108
1117
1109
	/* check if we should use HTTP instead */
1118
	/* check if we should use HTTP instead */
1110
	if (purl && (strcmp(purl->scheme, SCHEME_HTTP) == 0 ||
1119
	if (purl && (strcmp(purl->scheme, SCHEME_HTTP) == 0 ||
Lines 1130-1135 Link Here
1130
	if (ftp_cwd(conn, url->doc) == -1)
1139
	if (ftp_cwd(conn, url->doc) == -1)
1131
		goto errsock;
1140
		goto errsock;
1132
1141
1142
	cp = url->doc + strlen(url->doc) - 1;
1143
	if (cp >= url->doc && *cp == '/') {
1144
		/* list directory */
1145
		if (us) {
1146
			us->size = -1;
1147
			us->atime = us->mtime = 0;
1148
		}
1149
		/* list the directory */
1150
		return ftp_transfer(conn, "LIST", url->doc, O_RDONLY,
1151
			url->offset, flags);
1152
	}
1153
1133
	/* stat file */
1154
	/* stat file */
1134
	if (us && ftp_stat(conn, url->doc, us) == -1
1155
	if (us && ftp_stat(conn, url->doc, us) == -1
1135
	    && fetchLastErrCode != FETCH_PROTO
1156
	    && fetchLastErrCode != FETCH_PROTO

Return to bug 154988