diff -rNuX /home/mccreed/exclude2nd /home/mccreed/curl-7.15.3-20060314/include/curl/curl.h /home/mccreed/curl/include/curl/curl.h --- /home/mccreed/curl-7.15.3-20060314/include/curl/curl.h 2006-03-13 22:00:48.000000000 -0500 +++ /home/mccreed/curl/include/curl/curl.h 2006-03-15 14:02:27.000000000 -0500 @@ -1292,9 +1292,10 @@ CURLINFO_SSL_ENGINES = CURLINFO_SLIST + 27, CURLINFO_COOKIELIST = CURLINFO_SLIST + 28, CURLINFO_LASTSOCKET = CURLINFO_LONG + 29, + CURLINFO_FTP_ENTRY_PATH = CURLINFO_STRING + 30, /* Fill in new entries below here! */ - CURLINFO_LASTONE = 29 + CURLINFO_LASTONE = 30 } CURLINFO; /* CURLINFO_RESPONSE_CODE is the new name for the option previously known as diff -rNuX /home/mccreed/exclude2nd /home/mccreed/curl-7.15.3-20060314/lib/ftp.c /home/mccreed/curl/lib/ftp.c --- /home/mccreed/curl-7.15.3-20060314/lib/ftp.c 2006-03-13 22:00:49.000000000 -0500 +++ /home/mccreed/curl/lib/ftp.c 2006-03-15 14:20:00.000000000 -0500 @@ -2524,6 +2524,8 @@ } ftp->entrypath =dir; /* remember this */ infof(data, "Entry path is '%s'\n", ftp->entrypath); + /* also save it where getinfo can access it: */ + data->state.most_recent_ftp_entrypath = ftp->entrypath; } else { /* couldn't get the path */ @@ -3417,8 +3419,12 @@ if(ftp) { (void)ftp_quit(conn); /* ignore errors on the QUIT */ - if(ftp->entrypath) + if(ftp->entrypath) { + struct SessionHandle *data = conn->data; + data->state.most_recent_ftp_entrypath = NULL; free(ftp->entrypath); + ftp->entrypath = NULL; + } if(ftp->cache) { free(ftp->cache); ftp->cache = NULL; diff -rNuX /home/mccreed/exclude2nd /home/mccreed/curl-7.15.3-20060314/lib/getinfo.c /home/mccreed/curl/lib/getinfo.c --- /home/mccreed/curl-7.15.3-20060314/lib/getinfo.c 2006-02-11 22:00:07.000000000 -0500 +++ /home/mccreed/curl/lib/getinfo.c 2006-03-15 13:48:14.000000000 -0500 @@ -187,6 +187,14 @@ case CURLINFO_COOKIELIST: *param_slistp = Curl_cookie_list(data); break; + case CURLINFO_FTP_ENTRY_PATH: + /* Return the entrypath string from the most recent connection. + This pointer was copied from the connectdata structure by FTP. + The actual string may be free()ed by subsequent libcurl calls so + it must be copied to a safer area before the next libcurl call. + Callers must never free it themselves. */ + *param_charp = data->state.most_recent_ftp_entrypath; + break; case CURLINFO_LASTSOCKET: if((data->state.lastconnect != -1) && (data->state.connects[data->state.lastconnect] != NULL)) diff -rNuX /home/mccreed/exclude2nd /home/mccreed/curl-7.15.3-20060314/lib/urldata.h /home/mccreed/curl/lib/urldata.h --- /home/mccreed/curl-7.15.3-20060314/lib/urldata.h 2006-03-07 22:00:19.000000000 -0500 +++ /home/mccreed/curl/lib/urldata.h 2006-03-15 13:52:13.000000000 -0500 @@ -822,7 +822,7 @@ /* * Values that are generated, temporary or calculated internally for a - * "session handle" must be defined within the 'struct urlstate'. This struct + * "session handle" must be defined within the 'struct UrlState'. This struct * will be used within the SessionHandle struct. When the 'SessionHandle' * struct is cloned, this data MUST NOT be copied. * @@ -910,6 +910,10 @@ #if defined(USE_SSLEAY) && defined(HAVE_OPENSSL_ENGINE_H) ENGINE *engine; #endif /* USE_SSLEAY */ + + /* a place to store the most recenlty set FTP entrypath */ + char *most_recent_ftp_entrypath; + }; @@ -939,7 +943,7 @@ * This 'UserDefined' struct must only contain data that is set once to go * for many (perhaps) independent connections. Values that are generated or * calculated internally for the "session handle" MUST be defined within the - * 'struct urlstate' instead. The only exceptions MUST note the changes in + * 'struct UrlState' instead. The only exceptions MUST note the changes in * the 'DynamicStatic' struct. */ @@ -953,7 +957,7 @@ this. */ void *out; /* the fetched file goes here */ void *in; /* the uploaded file is read from here */ - void *writeheader; /* write the header to this is non-NULL */ + void *writeheader; /* write the header to this if non-NULL */ char *set_url; /* what original URL to work on */ char *set_proxy; /* proxy to use */ long use_port; /* which port to use (when not using default) */ @@ -1100,7 +1104,7 @@ * From now on, the 'SessionHandle' must only contain data that is set once to * go for many (perhaps) independent connections. Values that are generated or * calculated internally for the "session handle" must be defined within the - * 'struct urlstate' instead. */ + * 'struct UrlState' instead. */ struct SessionHandle { struct curl_hash *hostcache; diff -rNuX /home/mccreed/exclude2nd /home/mccreed/curl-7.15.3-20060314/src/writeout.c /home/mccreed/curl/src/writeout.c --- /home/mccreed/curl-7.15.3-20060314/src/writeout.c 2006-02-23 22:00:17.000000000 -0500 +++ /home/mccreed/curl/src/writeout.c 2006-03-15 14:04:44.000000000 -0500 @@ -60,6 +60,7 @@ VAR_NUM_CONNECTS, VAR_REDIRECT_TIME, VAR_REDIRECT_COUNT, + VAR_FTP_ENTRY_PATH, VAR_NUM_OF_VARS /* must be the last */ } replaceid; @@ -88,6 +89,7 @@ {"num_connects", VAR_NUM_CONNECTS}, {"time_redirect", VAR_REDIRECT_TIME}, {"num_redirects", VAR_REDIRECT_COUNT}, + {"ftp_entry_path", VAR_FTP_ENTRY_PATH}, {NULL, VAR_NONE} }; @@ -213,6 +215,13 @@ curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &stringp)) && stringp) fputs(stringp, stream); + break; + case VAR_FTP_ENTRY_PATH: + if((CURLE_OK == + curl_easy_getinfo(curl, CURLINFO_FTP_ENTRY_PATH, &stringp)) + && stringp) + fputs(stringp, stream); + break; default: break; }