}
data->state.path++; /* don't include the initial slash */
+ data->state.slash_removed = TRUE; /* we've skipped the slash */
/* FTP URLs support an extension like ";type=<typecode>" that
* we'll try to get now! */
if(type) {
*type = 0; /* it was in the middle of the hostname */
command = Curl_raw_toupper(type[6]);
+ conn->bits.type_set = TRUE;
switch (command) {
case 'A': /* ASCII mode */
if(conn->bits.httpproxy) {
/* we need to create new URL with the new port number */
char *url;
- /* FTPS connections have the FTP bit set too, so they match as well */
- bool isftp = (bool)(0 != (conn->protocol & PROT_FTP));
+ char type[12]="";
+
+ if(conn->bits.type_set)
+ snprintf(type, sizeof(type), ";type=%c",
+ data->set.prefer_ascii?'A':
+ (data->set.ftp_list_only?'D':'I'));
/*
- * This synthesized URL isn't always right--suffixes like ;type=A
- * are stripped off. It would be better to work directly from the
- * original URL and simply replace the port part of it.
+ * This synthesized URL isn't always right--suffixes like ;type=A are
+ * stripped off. It would be better to work directly from the original
+ * URL and simply replace the port part of it.
*/
- url = aprintf("%s://%s%s%s:%hu%s%s", conn->handler->scheme,
+ url = aprintf("%s://%s%s%s:%hu%s%s%s", conn->handler->scheme,
conn->bits.ipv6_ip?"[":"", conn->host.name,
conn->bits.ipv6_ip?"]":"", conn->remote_port,
- isftp?"/":"", data->state.path);
+ data->state.slash_removed?"/":"", data->state.path,
+ type);
if(!url)
return CURLE_OUT_OF_MEMORY;
that libcurl should reconnect and continue. */
bool bound; /* set true if bind() has already been done on this socket/
connection */
+ bool type_set; /* type= was used in the URL */
};
struct hostname {
char *pathbuffer;/* allocated buffer to store the URL's path part in */
char *path; /* path to use, points to somewhere within the pathbuffer
area */
-
+ bool slash_removed; /* set TRUE if the 'path' points to a path where the
+ initial URL slash separator has been taken off */
bool use_range;
bool rangestringalloc; /* the range string is malloc()'ed */