Show how to make an URL HEAD request in an non-exported section

This commit is contained in:
Gerard Vermeulen 2024-03-27 14:17:43 +01:00
parent 53b11078e6
commit 668ca13a02

View File

@ -6952,6 +6952,50 @@ GET https://pypi.org/simple/numpy
Accept: application/vnd.pypi.simple.latest+json
#+end_src
*** [[info:url#Top][URL (info)]] :noexport:
:PROPERTIES:
:CUSTOM_ID: sec:url
:END:
[[https://lists.gnu.org/archive/html/emacs-devel/2024-03/msg00670.html][How to retrieve only URL metadata]]
#+caption[Make an URL HEAD request]:
#+caption: Make an URL HEAD request.
#+name: lst:url-head-request
#+header: :wrap "src text -n :eval no"
#+begin_src emacs-lisp -n :eval never-export :exports both :tangle no
(with-current-buffer
(let ((url-request-method "HEAD"))
(url-retrieve-synchronously "https://www.gnu.org/"))
(buffer-string))
#+end_src
#+caption[URL HEAD request result]:
#+caption: URL HEAD request result.
#+name: lst:url-head-request-result
#+RESULTS: lst:url-head-request
#+begin_src text -n :eval no
HTTP/1.1 200 OK
Date: Wed, 27 Mar 2024 07:40:07 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 07:40:07 GMT
Content-Length: 9803
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html
Content-Language: en
#+end_src
*** [[https://www.emacswiki.org/emacs/WebJump][Webjump]]
:PROPERTIES:
:CUSTOM_ID: sec:webjump