Created
July 2, 2018 09:06
-
-
Save bhelyer/9a5b4d2d474035be9eba5f4e40bcd951 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module main; | |
| import io = watt.io; | |
| import http = watt.http; | |
| enum Base = "digitalmars.com"; | |
| enum Child = "bibliography.html"; | |
| fn main() i32 | |
| { | |
| withSlash := getText(Base, "/${Child}"); | |
| sansSlash := getText(Base, Child); | |
| if (withSlash is null || sansSlash is null) { | |
| return 1; | |
| } | |
| if (withSlash != sansSlash) { | |
| return 2; | |
| } | |
| io.writeln(withSlash); | |
| return 0; | |
| } | |
| fn getText(base: string, child: string) string | |
| { | |
| h := new http.Http(); | |
| r := new http.Request(h); | |
| r.server = base; | |
| r.url = child; | |
| r.port = 443; | |
| r.secure = true; | |
| h.loop(); | |
| return r.getString(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment