Skip to content

Instantly share code, notes, and snippets.

@bhelyer
Created July 2, 2018 09:06
Show Gist options
  • Select an option

  • Save bhelyer/9a5b4d2d474035be9eba5f4e40bcd951 to your computer and use it in GitHub Desktop.

Select an option

Save bhelyer/9a5b4d2d474035be9eba5f4e40bcd951 to your computer and use it in GitHub Desktop.
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