Last active
August 29, 2015 14:14
-
-
Save ableasdale/3e283fb74ff2173a6da7 to your computer and use it in GitHub Desktop.
MarkLogic: xdmp:http-get() with Squid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "1.0-ml"; | |
declare function local:http-get-proxy($proxy as xs:string, $uri as xs:string) { | |
let $host := tokenize($uri,'/')[3] | |
let $proxyuri := resolve-uri(substring-after($uri, $host), $proxy) | |
return | |
xdmp:http-get($proxyuri, | |
<options xmlns="xdmp:http"> | |
<headers> | |
<Host>{$host}</Host> | |
</headers> | |
</options>) | |
}; | |
local:http-get-proxy("http://192.168.1.100:3128", "http://www.marklogic.com") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment