UriUtil: support ftp:// URLs in uri_remove_auth()
This commit is contained in:
		@@ -98,6 +98,8 @@ uri_remove_auth(const char *uri)
 | 
				
			|||||||
		auth = uri + 7;
 | 
							auth = uri + 7;
 | 
				
			||||||
	else if (memcmp(uri, "https://", 8) == 0)
 | 
						else if (memcmp(uri, "https://", 8) == 0)
 | 
				
			||||||
		auth = uri + 8;
 | 
							auth = uri + 8;
 | 
				
			||||||
 | 
						else if (memcmp(uri, "ftp://", 6) == 0)
 | 
				
			||||||
 | 
							auth = uri + 6;
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		/* unrecognized URI */
 | 
							/* unrecognized URI */
 | 
				
			||||||
		return std::string();
 | 
							return std::string();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -44,6 +44,8 @@ public:
 | 
				
			|||||||
				     uri_remove_auth("http://foo@www.example.com/"));
 | 
									     uri_remove_auth("http://foo@www.example.com/"));
 | 
				
			||||||
		CPPUNIT_ASSERT_EQUAL(std::string(),
 | 
							CPPUNIT_ASSERT_EQUAL(std::string(),
 | 
				
			||||||
				     uri_remove_auth("http://www.example.com/f:oo@bar"));
 | 
									     uri_remove_auth("http://www.example.com/f:oo@bar"));
 | 
				
			||||||
 | 
							CPPUNIT_ASSERT_EQUAL(std::string("ftp://ftp.example.com/"),
 | 
				
			||||||
 | 
									     uri_remove_auth("ftp://foo:bar@ftp.example.com/"));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user