unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Adam Porter <adam@alphapapa.net>
To: raman@google.com
Cc: emacs-devel@gnu.org
Subject: Re: Howto: Retrieve only URL metadata
Date: Tue, 26 Mar 2024 23:17:22 -0500	[thread overview]
Message-ID: <52f4e345-b805-455b-9ec6-2907d3d1315a@alphapapa.net> (raw)
In-Reply-To: <26115.36206.776145.115534@google.com>

> Is there a light-weight means of just retrieving URL metadata given a
> URL using the url package in Emacs?
> 
> Note: I know how to do that using Curl and parsing the output from a
> HEAD method call; am looking for a pure elisp solution

FYI, if you'll forgive the transgression, since plz.el is in ELPA and 
"part of Emacs", here's a simple way to do it:

   (plz-response-headers
    (plz 'head 
"https://lists.gnu.org/archive/html/emacs-devel/2024-03/msg00670.html"
      :as 'response))

   ;; ((date . "Wed, 27 Mar 2024 04:11:27 GMT")
   ;;  (server . "Apache/2.4.29 (Trisquel_GNU/Linux)")
   ;;  (strict-transport-security . "max-age=63072000; 
includeSubDomains; preload")
   ;;  (x-frame-options . "sameorigin")
   ;;  (x-content-type-options . "nosniff")
   ;;  (last-modified . "Wed, 27 Mar 2024 03:44:54 GMT")
   ;;  (etag . "\"1472-6149c3ac97980-gzip\"")
   ;;  (accept-ranges . "bytes")
   ;;  (vary . "Accept-Encoding")
   ;;  (content-encoding . "gzip")
   ;;  (content-length . "2022")
   ;;  (content-type . "text/html"))

A future version will probably simplify that, returning the alist of 
headers directly for calling:

   (plz 'head URL)



  parent reply	other threads:[~2024-03-27  4:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-27  3:07 Howto: Retrieve only URL metadata T.V Raman
2024-03-27  3:44 ` Tim Landscheidt
2024-03-27  4:17 ` Adam Porter [this message]
2024-03-27 13:32   ` T.V Raman
2024-03-28  2:42   ` T.V Raman
2024-03-28 10:35     ` Adam Porter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52f4e345-b805-455b-9ec6-2907d3d1315a@alphapapa.net \
    --to=adam@alphapapa.net \
    --cc=emacs-devel@gnu.org \
    --cc=raman@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).