Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

15
LINES

< > BotCompany Repo | #1016489 // getURLHeadersByHEAD

JavaX fragment (include)

static Map<S, L<S>> getURLHeadersByHEAD(String url) ctex {
  url = absoluteURL(url);
  if (!networkAllowanceTest(url)) fail("Not allowed: " + url);
  HttpURLConnection conn = null;
  InputStream in = null;
  try {
    conn = (HttpURLConnection) new URL(url).openConnection();
    conn.setRequestMethod("HEAD");
    conn.setRequestProperty("X-No-Cookies", "1");
    in = conn.getInputStream();
    ret toCIMap(conn.getHeaderFields());
  } finally {
    closeURLConnection(conn, in);
  }
}

Author comment

Began life as a copy of #1002941

download  show line numbers  debug dex  old transpilations   

Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, wnsclhtenguj

No comments. add comment

Snippet ID: #1016489
Snippet name: getURLHeadersByHEAD
Eternal ID of this version: #1016489/5
Text MD5: f2ecbc92dc585d1e79b6b57db19c4bd4
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-12 08:17:26
Source code size: 503 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 272 / 328
Version history: 4 change(s)
Referenced in: [show references]