Skip to content

Commit

Permalink
added HTTP header for Connection=Close to the eXist native httpclient
Browse files Browse the repository at this point in the history
yet again the database was stalling due to too many open files (aka
connections in CLOSED_WAIT, see `lsof -i`)
  • Loading branch information
peterstadler committed Jun 12, 2017
1 parent 9b19a51 commit c35989c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions modules/wega-util.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,8 @@ declare function wega-util:http-get($url as xs:anyURI) as element(wega:externalR
: @return element wega:externalResource, a wrapper around httpclient:response
:)
declare function wega-util:httpclient-get($url as xs:anyURI) as element(wega:externalResource) {
let $req := <http:request href="{$url}" method="get" timeout="3"><http:header name="Connection" value="close"/></http:request>
let $response :=
try { httpclient:get($url, true(), <Headers/>) }
try { httpclient:get($url, true(), <headers><header name="Connection" value="close"/></headers>) }
catch * {core:logToFile('warn', string-join(('wega-util:httpclient-get', $err:code, $err:description, 'URL: ' || $url), ' ;; '))}
(:let $response :=
if($response/httpclient:body[matches(@mimetype,"text/html")]) then wega:changeNamespace($response,'http://www.w3.org/1999/xhtml', 'http://exist-db.org/xquery/httpclient')
Expand Down

0 comments on commit c35989c

Please sign in to comment.