// retrieves url with HEAD, measures how long it takes.
public static long getTimeToHEAD(String url) {
try {
if (!url.contains("//")) url = "http://" + url;
long startTime = now();
HttpURLConnection con =
(HttpURLConnection) new URL(url).openConnection();
con.setRequestMethod("HEAD");
con.getResponseCode();
return now()-startTime;
}
catch (Exception e) {
return -1;
}
}Began life as a copy of #1001114
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1001555 |
| Snippet name: | getTimeToHEAD |
| Eternal ID of this version: | #1001555/1 |
| Text MD5: | 0003d11aff6b807caea9294547d2a90e |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2015-10-24 18:35:48 |
| Source code size: | 467 bytes / 16 lines |
| Pitched / IR pitched: | No / Yes |
| Views / Downloads: | 1030 / 1247 |
| Referenced in: | #1002427 - Accellerating 629 (SPIKE) #1002941 - getURLSizeByHEAD #1006654 - Standard functions list 2 (LIVE, continuation of #761) #3000382 - Answer for ferdie (>> t = 1, f = 0) #3000383 - Answer for funkoverflow (>> t=1, f=0 okay) |