unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Tim Landscheidt <tim@tim-landscheidt.de>
To: "T.V Raman" <raman@google.com>
Cc: emacs-devel@gnu.org
Subject: Re: Howto: Retrieve only URL metadata
Date: Wed, 27 Mar 2024 03:44:44 +0000	[thread overview]
Message-ID: <87plvg8hjn.fsf@vagabond.tim-landscheidt.de> (raw)
In-Reply-To: <26115.36206.776145.115534@google.com> (T. V. Raman's message of "Tue, 26 Mar 2024 20:07:26 -0700")

"T.V Raman" <raman@google.com> wrote:

> 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

You can set url-request-method to "HEAD"
(cf. https://www.rfc-editor.org/rfc/rfc9110.html#name-methods
for more obscure methods):

| ELISP> (with-current-buffer
|            (let
|                ((url-request-method "HEAD"))
|              (url-retrieve-synchronously "https://www.gnu.org/"))
|          (buffer-string))
| "HTTP/1.1 200 OK
| Date: Wed, 27 Mar 2024 03:41:54 GMT
| Server: Apache/2.4.29
| Content-Location: home.html
| Vary: negotiate,accept-language,Accept-Encoding
| TCN: choice
| Strict-Transport-Security: max-age=63072000
| X-Frame-Options: sameorigin
| X-Content-Type-Options: nosniff
| Access-Control-Allow-Origin: (null)
| Accept-Ranges: bytes
| Cache-Control: max-age=0
| Expires: Wed, 27 Mar 2024 03:41:54 GMT
| Content-Length: 9803
| Keep-Alive: timeout=5, max=100
| Connection: Keep-Alive
| Content-Type: text/html
| Content-Language: en

| "
| ELISP>

Tim



  reply	other threads:[~2024-03-27  3:44 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 [this message]
2024-03-27  4:17 ` Adam Porter
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=87plvg8hjn.fsf@vagabond.tim-landscheidt.de \
    --to=tim@tim-landscheidt.de \
    --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).