Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Resolve invalid subdomain issue #112
Conversation
| @@ -350,10 +353,15 @@ checkIfLogglyServersAccessible() { | |||
| fi | |||
|
|
|||
| echo "INFO: Checking if '$LOGGLY_ACCOUNT' subdomain is valid." | |||
| if [ $(curl --head -s --request GET $LOGGLY_ACCOUNT_URL/login | grep "200 OK\|HTTP/2 200" | wc -l) ] >0; then | |||
| echo "INFO: $LOGGLY_ACCOUNT_URL is valid and reachable." | |||
| if [[ $LOGGLY_ACCOUNT != $INVALID_SUBDOMAIN ]]; then | |||
Shwetajain148
Jan 30, 2018
Author
Contributor
@mchaudhary, This condition is to check if the subdomain is not invalid i.e. it does not contain .loggly.com in it.
@mchaudhary, This condition is to check if the subdomain is not invalid i.e. it does not contain .loggly.com in it.
| @@ -350,10 +353,15 @@ checkIfLogglyServersAccessible() { | |||
| fi | |||
|
|
|||
| echo "INFO: Checking if '$LOGGLY_ACCOUNT' subdomain is valid." | |||
| if [ $(curl --head -s --request GET $LOGGLY_ACCOUNT_URL/login | grep "200 OK\|HTTP/2 200" | wc -l) ] >0; then | |||
Shwetajain148
Jan 30, 2018
Author
Contributor
@mchaudhary, At this point earlier, if I pass any invalid subdomain which doesn't contain .loggly.com with it but also does not exist, the script was marking it as a valid subdomain and showing it is reachable. This was happening because it checks at last if wc -l > 0 then mark the subdomain valid and reachable. But actually what happens is if we pass any invalid subdomain which does not exist, the response is multiline which satisfies this condition and subdomain is marked as valid.
Note: In both valid and invalid subdomain the response is in multiline so the script could not differentiate.
@mchaudhary, At this point earlier, if I pass any invalid subdomain which doesn't contain .loggly.com with it but also does not exist, the script was marking it as a valid subdomain and showing it is reachable. This was happening because it checks at last if wc -l > 0 then mark the subdomain valid and reachable. But actually what happens is if we pass any invalid subdomain which does not exist, the response is multiline which satisfies this condition and subdomain is marked as valid.
Note: In both valid and invalid subdomain the response is in multiline so the script could not differentiate.
| if [ $(curl --head -s --request GET $LOGGLY_ACCOUNT_URL/login | grep "200 OK\|HTTP/2 200" | wc -l) ] >0; then | ||
| echo "INFO: $LOGGLY_ACCOUNT_URL is valid and reachable." | ||
| if [[ $LOGGLY_ACCOUNT != $INVALID_SUBDOMAIN ]]; then | ||
| if [[ $(curl --head -s --request GET $LOGGLY_ACCOUNT_URL/login | grep "200 OK\|HTTP/2 200") ]]; then |
Shwetajain148
Jan 30, 2018
Author
Contributor
I modified this condition to grep only the 200 response code and then mark the subdomain valid.
I modified this condition to grep only the 200 response code and then mark the subdomain valid.
@mchaudhary In this PR, I have put a check to validate if the subdomain contains .loggly.com with it. The user must enter only the first string of his account name for the subdomain. If user enters the complete account name, the script will mark this subdomain invalid, display an error message and will exit.
I have also added a clear exit message so the users do not confuse.
Please review.