From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tim Landscheidt Newsgroups: gmane.emacs.devel Subject: Re: Howto: Retrieve only URL metadata Date: Wed, 27 Mar 2024 03:44:44 +0000 Organization: https://www.tim-landscheidt.de/ Message-ID: <87plvg8hjn.fsf@vagabond.tim-landscheidt.de> References: <26115.36206.776145.115534@google.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27469"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.3 (gnu/linux) Cc: emacs-devel@gnu.org To: "T.V Raman" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Mar 27 04:45:34 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rpKEI-0006us-24 for ged-emacs-devel@m.gmane-mx.org; Wed, 27 Mar 2024 04:45:34 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rpKDf-0003q6-8Z; Tue, 26 Mar 2024 23:44:55 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rpKDc-0003pY-Lj for emacs-devel@gnu.org; Tue, 26 Mar 2024 23:44:53 -0400 Original-Received: from gavdos.tim-landscheidt.de ([2a01:4f8:1c0c:4bd6::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rpKDZ-0006Fh-UF for emacs-devel@gnu.org; Tue, 26 Mar 2024 23:44:51 -0400 Original-Received: from [85.195.93.93] (port=40582 helo=vagabond) by gavdos.tim-landscheidt.de with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1rpKDV-00GbQo-2b; Wed, 27 Mar 2024 03:44:45 +0000 In-Reply-To: <26115.36206.776145.115534@google.com> (T. V. Raman's message of "Tue, 26 Mar 2024 20:07:26 -0700") Received-SPF: pass client-ip=2a01:4f8:1c0c:4bd6::1; envelope-from=tim@tim-landscheidt.de; helo=gavdos.tim-landscheidt.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:317320 Archived-At: "T.V Raman" 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