Skip to content

Instantly share code, notes, and snippets.

@ableasdale
Last active August 29, 2015 14:14
Show Gist options
  • Save ableasdale/3e283fb74ff2173a6da7 to your computer and use it in GitHub Desktop.
Save ableasdale/3e283fb74ff2173a6da7 to your computer and use it in GitHub Desktop.
MarkLogic: xdmp:http-get() with Squid
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