Commit e3435df6 authored by Eric Timmons's avatar Eric Timmons
Browse files

Simplify HTTP Client header generation

parent b9769973
...@@ -129,7 +129,9 @@ Returns T if the contents of PATHNAME were modified, NIL otherwise." ...@@ -129,7 +129,9 @@ Returns T if the contents of PATHNAME were modified, NIL otherwise."
;; Base the tmp pathname off the pathname pathname to try and ensure that ;; Base the tmp pathname off the pathname pathname to try and ensure that
;; they are on the same filesystem. ;; they are on the same filesystem.
(let ((tmp-pathname (uiop:tmpize-pathname pathname)) (let ((tmp-pathname (uiop:tmpize-pathname pathname))
(additional-headers nil)) (additional-headers (get-additional-headers-for-hostname
(puri:uri-host url)
(puri:uri-scheme url))))
(when (and (not force) (when (and (not force)
(probe-file pathname)) (probe-file pathname))
(push (cons :if-modified-since (universal-time-to-http-date (file-write-date pathname))) (push (cons :if-modified-since (universal-time-to-http-date (file-write-date pathname)))
...@@ -140,11 +142,7 @@ Returns T if the contents of PATHNAME were modified, NIL otherwise." ...@@ -140,11 +142,7 @@ Returns T if the contents of PATHNAME were modified, NIL otherwise."
(multiple-value-bind (http-stream status-code) (multiple-value-bind (http-stream status-code)
(http-request url (http-request url
:want-stream t :want-stream t
:additional-headers (append :additional-headers additional-headers)
(get-additional-headers-for-hostname
(puri:uri-host url)
(puri:uri-scheme url))
additional-headers))
(log:debug "Status code: ~S" status-code) (log:debug "Status code: ~S" status-code)
(case status-code (case status-code
(200 (200
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment