aboutsummaryrefslogtreecommitdiffstats
path: root/main/dansguardian/ftp-credential.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/dansguardian/ftp-credential.patch')
-rw-r--r--main/dansguardian/ftp-credential.patch41
1 files changed, 41 insertions, 0 deletions
diff --git a/main/dansguardian/ftp-credential.patch b/main/dansguardian/ftp-credential.patch
new file mode 100644
index 0000000000..cfe472909a
--- /dev/null
+++ b/main/dansguardian/ftp-credential.patch
@@ -0,0 +1,41 @@
+If anyone is interested I updated the workaround ftp credential patch
+for 2.10.1.1. The previous one bombed on urls with email addresses in them.
+
+This one will probably bomb someplace else :)
+
+7/9/2009 ftp patch:
+
+--- a/src/HTTPHeader.cpp 2009-06-13 14:10:15.000000000 -0500
++++ b/src/HTTPHeader.cpp 2009-07-09 17:29:16.000000000 -0500
+@@ -402,7 +402,7 @@
+ // modifies the URL in all relevant header lines after a regexp search and replace
+ // setURL Code originally from from Ton Gorter 2004
+ void HTTPHeader::setURL(String &url) {
+- String hostname;
++ String hostname,credentials;
+ bool https = (url.before("://") == "https");
+ int port = (https ? 443 : 80);
+
+@@ -420,12 +420,18 @@
+ }
+ hostname = hostname.before(":"); // chop off the port bit
+ }
++ //Restore stripped credentials
++ credentials="";
++ if (header.front().after("://").before(hostname.toCharArray()).contains("@")) { // Contains a username:password combo
++ credentials = header.front().after("://").before(hostname.toCharArray());
++ }
++
+
+ #ifdef DGDEBUG
+ std::cout << "setURL: header.front() changed from: " << header.front() << std::endl;
+ #endif
+ if (!https)
+- header.front() = header.front().before(" ") + " " + url + " " + header.front().after(" ").after(" ");
++ header.front() = header.front().before(" ") + " " + url.before("://") + "://" + credentials + url.after("://") + " " + header.front().after(" ").after(" ");
+ else
+ // Should take form of "CONNECT example.com:443 HTTP/1.0" for SSL
+ header.front() = header.front().before(" ") + " " + hostname + ":" + String(port) + " " + header.front().after(" ").after(" ");
+
+
+