View | Details | Raw Unified | Return to bug 154988
Collapse All | Expand All

(-)lib/libfetch/ftp.c (-2 / +23 lines)
Lines 776-782 Link Here
776
		/* make the server initiate the transfer */
776
		/* make the server initiate the transfer */
777
		if (verbose)
777
		if (verbose)
778
			fetch_info("initiating transfer");
778
			fetch_info("initiating transfer");
779
		e = ftp_cmd(conn, "%s %.*s", oper, filenamelen, filename);
779
		if (*filename != '\0')
780
			e = ftp_cmd(conn, "%s %.*s", oper, filenamelen,
781
			    filename);
782
		else
783
			e = ftp_cmd(conn, "%s", oper);
780
		if (e != FTP_CONNECTION_ALREADY_OPEN && e != FTP_OPEN_DATA_CONNECTION)
784
		if (e != FTP_CONNECTION_ALREADY_OPEN && e != FTP_OPEN_DATA_CONNECTION)
781
			goto ouch;
785
			goto ouch;
782
786
Lines 867-873 Link Here
867
		/* make the server initiate the transfer */
871
		/* make the server initiate the transfer */
868
		if (verbose)
872
		if (verbose)
869
			fetch_info("initiating transfer");
873
			fetch_info("initiating transfer");
870
		e = ftp_cmd(conn, "%s %.*s", oper, filenamelen, filename);
874
		if (*filename != '\0')
875
			e = ftp_cmd(conn, "%s %.*s", oper, filenamelen,
876
			    filename);
877
		else
878
			e = ftp_cmd(conn, "%s", oper);
871
		if (e != FTP_CONNECTION_ALREADY_OPEN && e != FTP_OPEN_DATA_CONNECTION)
879
		if (e != FTP_CONNECTION_ALREADY_OPEN && e != FTP_OPEN_DATA_CONNECTION)
872
			goto ouch;
880
			goto ouch;
873
881
Lines 1099-1104 Link Here
1099
{
1107
{
1100
	conn_t *conn;
1108
	conn_t *conn;
1101
	int oflag;
1109
	int oflag;
1110
	char *cp;
1102
1111
1103
	/* check if we should use HTTP instead */
1112
	/* check if we should use HTTP instead */
1104
	if (purl && strcasecmp(purl->scheme, SCHEME_HTTP) == 0) {
1113
	if (purl && strcasecmp(purl->scheme, SCHEME_HTTP) == 0) {
Lines 1123-1128 Link Here
1123
	if (ftp_cwd(conn, url->doc) == -1)
1132
	if (ftp_cwd(conn, url->doc) == -1)
1124
		goto errsock;
1133
		goto errsock;
1125
1134
1135
	cp = url->doc + strlen(url->doc) - 1;
1136
	if (cp >= url->doc && *cp == '/') {
1137
		/* list directory */
1138
		if (us) {
1139
			us->size = -1;
1140
			us->atime = us->mtime = 0;
1141
		}
1142
		/* list the directory */
1143
		return ftp_transfer(conn, "LIST", url->doc, O_RDONLY,
1144
		    url->offset, flags);
1145
	}
1146
1126
	/* stat file */
1147
	/* stat file */
1127
	if (us && ftp_stat(conn, url->doc, us) == -1
1148
	if (us && ftp_stat(conn, url->doc, us) == -1
1128
	    && fetchLastErrCode != FETCH_PROTO
1149
	    && fetchLastErrCode != FETCH_PROTO

Return to bug 154988