mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-23 20:05:32 +02:00
Add support for HTTP proxies.
* module/web/http.scm (http-proxy-port?, set-http-proxy-port?!): New exported procedures. (write-request-line): If we're using an http proxy, write an absolute-URI in the request line. * module/web/client.scm: Import (web http). (current-http-proxy): New exported parameter. (open-socket-for-uri): If 'current-http-proxy' is not false, connect to the proxy instead of the URI host, and use 'set-http-proxy-port?!' to make note of that fact. * doc/ref/web.texi (Web Client): Document 'current-http-proxy'.
This commit is contained in:
parent
0690378621
commit
23cf330c86
3 changed files with 50 additions and 3 deletions
|
@ -1459,6 +1459,20 @@ fetcher, similar in structure to the web server (@pxref{Web Server}).
|
|||
Another option, good but not as performant, would be to use threads,
|
||||
possibly via par-map or futures.
|
||||
|
||||
@deffn {Scheme Parameter} current-http-proxy
|
||||
Either @code{#f} or a non-empty string containing the URL of the HTTP
|
||||
proxy server to be used by the procedures in the @code{(web client)}
|
||||
module, including @code{open-socket-for-uri}. Its initial value is
|
||||
based on the @env{http_proxy} environment variable.
|
||||
|
||||
@example
|
||||
(current-http-proxy) @result{} "http://localhost:8123/"
|
||||
(parameterize ((current-http-proxy #f))
|
||||
(http-get "http://example.com/")) ; temporarily bypass proxy
|
||||
(current-http-proxy) @result{} "http://localhost:8123/"
|
||||
@end example
|
||||
@end deffn
|
||||
|
||||
|
||||
@node Web Server
|
||||
@subsection Web Server
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue