During Google search, Google often uses Google's security filter to filter network Trojans for security reasons, such
The following is a practical example. based on VC ++, googleurl can be used to conveniently and securely parse URLs.
# Include "stdafx. H "# include" googleurl \ SRC \ gurl. H "Void testurl (const char * lpszurl) {char szdomain [256]; char szurlpath [256]; szdomain [0] = 0; szurlpath [0] = 0; const char * szstart = NULL; const char * szpathstart = NULL; If (strnicmp (lpszurl, "http: //", 7) = 0) {// start with HTTP: szstart = lpszurl + 7;} else if (strnicmp (lpszurl, "https: //", 8) = 0) {// szstart = lpszurl + 8 at the beginning of HTTPS;} else {szstart = lpszurl;} szpath Start = strstr (szstart, "/"); If (szpathstart) {strcpy (szurlpath, szpathstart);} strncpy (szdomain, szstart, szpathstart-szstart ); szdomain [szpathstart-szstart] = 0; printf ("% s \ ndomain: % s \ npath: % s \ n", lpszurl, szdomain, szurlpath );} int _ tmain (INT argc, _ tchar * argv []) {STD: cout <STD: Endl <"testurl" <STD: Endl; testurl ("http://www.baidu.com/index.html"); // testurl ("http://www.ABCDEFGHIJKLMNOPQ ") Why? Zookeeper extends rstuvwxyzabcdefghijk Lmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefgh urlstd: cout <STD: Endl <"googleurl" <STD: Endl; gurl ("http: // User: 123456@foo.tengattack.com: 8080/index. PHP? Action = init "); STD: cout <" url: "<gurl <STD: Endl; // obtain the domain name \ host address STD: cout <"host ()->" <gurl. host () <STD: Endl; // obtain the port number if (gurl. has_port () STD: cout <"port ()->" <gurl. port () <STD: Endl; // obtain queryif (gurl. has_query () STD: cout <"query ()->" <gurl. query () <STD: Endl; // obtain the username and password if (gurl. has_username () STD: cout <"username ()->" <gurl. username () <STD: Endl; If (gurl. has_password () STD: cout <"password ()->" <gurl. password () <STD: Endl; // get the file name STD: cout <"extractfilename ()->" <gurl. extractfilename () <STD: Endl; // This is also the port number. The difference with port () is that even if no port is specified, the HTTP 80 port STD :: cout <"effectiveintport ()->" <gurl. inclutiveintport () <STD: Endl; // determines whether the domain name is an IP address STD: cout <"hostisipaddress ()->" <gurl. hostisipaddress () <STD: Endl; STD: cin. get (); Return 0 ;}