Skip to content

Commit

Permalink
Fix qlot/proxy.
Browse files Browse the repository at this point in the history
  • Loading branch information
fukamachi committed Nov 2, 2023
1 parent fd461e9 commit 88cbc02
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions proxy.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,27 @@
;; For some reason, a separate function definition
;; works as expected.
(defun qlot-http-fetch (url &rest rest)
(let ((ql:*proxy-url*
(if (eql (search #1="qlot://localhost/" url
:end2 (length #1#))
0)
nil
ql:*proxy-url*)))
(apply #'orig-http-fetch url rest))))
(if (find :quicklisp *features*)
(progv (list (intern (string '#:*proxy-url*) '#:ql))
;; do not use proxy if connect localhost
(list (if (eql (search #1="qlot://localhost/" url
:end2 (length #1#))
0)
nil
(symbol-value (intern (string '#:*proxy-url*) '#:ql))))
(apply #'orig-http-fetch url rest))
(apply #'orig-http-fetch url rest))))

#+quicklisp
(eval-when (:compile-toplevel :load-toplevel :execute)
(when (and (not (fboundp 'orig-http-fetch))
(find-package '#:ql-http))
;; dummy for suppress style warning
(defun orig-http-fetch (&rest args)
(declare (ignore args)))
(declare (ignore args))
(error "A dummy function is called"))
(setf (symbol-function 'orig-http-fetch)
(fdefinition
(find-symbol (string '#:http-fetch) '#:ql-http)))
;; do not use proxy if connect localhost
(setf (fdefinition (find-symbol (string '#:http-fetch) '#:ql-http))
#'qlot-http-fetch)))

0 comments on commit 88cbc02

Please sign in to comment.