From 3c5ead2ed6b28754b3f53d4a370c4be63ca7c409 Mon Sep 17 00:00:00 2001 From: Tomas Zellerin Date: Wed, 3 Jul 2013 19:16:50 +0200 Subject: [PATCH 1/2] Allow using default http proxy Define *default-http-proxy* variable to be used as default value for proxy parameter of the http-request call, and export it. --- packages.lisp | 1 + request.lisp | 4 ++-- specials.lisp | 7 +++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages.lisp b/packages.lisp index 156877d..2edfbe3 100644 --- a/packages.lisp +++ b/packages.lisp @@ -37,6 +37,7 @@ (:export #:*allow-dotless-cookie-domains-p* #:*body-format-function* #:*remove-duplicate-cookies-p* + #:*default-http-proxy* #:*drakma-default-external-format* #:*header-stream* #:*ignore-unparseable-cookie-dates-p* diff --git a/request.lisp b/request.lisp index f267a8f..e69c416 100644 --- a/request.lisp +++ b/request.lisp @@ -205,7 +205,7 @@ headers of the chunked stream \(if any) as a second value." (user-agent :drakma) (accept "*/*") range - proxy + (proxy *default-http-proxy*) proxy-basic-authorization real-host additional-headers @@ -377,7 +377,7 @@ list of two values - a string denoting the proxy server and an integer denoting the port to use \(which will default to 80 otherwise). PROXY-BASIC-AUTHORIZATION is used like BASIC-AUTHORIZATION, but for the proxy, and only if PROXY is -true. +true. Defaults to *default-http-proxy*. If REAL-HOST is not NIL, request is sent to the denoted host instead of the URI host. When specified, REAL-HOST supersedes PROXY. diff --git a/specials.lisp b/specials.lisp index ef278d6..554f487 100644 --- a/specials.lisp +++ b/specials.lisp @@ -248,6 +248,13 @@ proceeds as described in the HTTP-REQUEST documentation entry.") "An alist which maps time zone abbreviations to Common Lisp timezones.") +(defvar *default-http-proxy* nil + "HTTP proxy to be used as default. If not NIL, it should be a string +denoting a proxy server through which the request should be sent. Or +it can be a list of two values - a string denoting the proxy server +and an integer denoting the port to use \(which will default to 80 +otherwise).") + ;; stuff for Nikodemus Siivola's HYPERDOC ;; see ;; and From a8a3ba22125bfe74e3ab7c284b0a0fc0abac34ca Mon Sep 17 00:00:00 2001 From: Tomas Zellerin Date: Thu, 4 Jul 2013 18:14:07 +0200 Subject: [PATCH 2/2] Default proxy documentation update. --- doc/index.xml | 17 ++++++++++++++++- request.lisp | 5 +++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/doc/index.xml b/doc/index.xml index e2645bc..e3e7528 100644 --- a/doc/index.xml +++ b/doc/index.xml @@ -957,7 +957,8 @@ T the request should be sent. Or it can be a list of two values - a string denoting the proxy server and an integer denoting the port to use (which will default to 80 - otherwise). + otherwise). Defaults to + *default-http-proxy*. proxy-basic-authorization is used like basic-authorization, but for the proxy, and only if proxy is true. @@ -1172,6 +1173,20 @@ T + + +

+ HTTP proxy to be used as default for the proxy keyword + argument of HTTP-REQUEST. If not + NIL, it should be a string denoting a proxy + server through which the request should be sent. Or it + can be a list of two values - a string denoting the proxy + server and an integer denoting the port to use (which + will default to 80 otherwise). +

+
+
+

diff --git a/request.lisp b/request.lisp index e69c416..ded0420 100644 --- a/request.lisp +++ b/request.lisp @@ -375,9 +375,10 @@ If PROXY is not NIL, it should be a string denoting a proxy server through which the request should be sent. Or it can be a list of two values - a string denoting the proxy server and an integer denoting the port to use \(which will default to 80 -otherwise). PROXY-BASIC-AUTHORIZATION is used like +otherwise). Defaults to *default-http-proxy*. +PROXY-BASIC-AUTHORIZATION is used like BASIC-AUTHORIZATION, but for the proxy, and only if PROXY is -true. Defaults to *default-http-proxy*. +true. If REAL-HOST is not NIL, request is sent to the denoted host instead of the URI host. When specified, REAL-HOST supersedes PROXY.