/usr/share/doc/racket/net/http-client.html is in racket-doc 6.1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><title>1 HTTP Client</title><link rel="stylesheet" type="text/css" href="../scribble.css" title="default"/><link rel="stylesheet" type="text/css" href="../racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-style.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../doc-site.css" title="default"/><script type="text/javascript" src="../scribble-common.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../doc-site.js"></script><script type="text/javascript" src="../local-redirect/local-redirect.js"></script><script type="text/javascript" src="../local-redirect/local-user-redirect.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><body id="doc-racket-lang-org"><div class="tocset"><div class="tocview"><div class="tocviewlist tocviewlisttopspace"><div class="tocviewtitle"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_0");">▼</a></td><td></td><td><a href="index.html" class="tocviewlink" data-pltdoc="x">Net:<span class="mywbr"> </span> Networking Libraries</a></td></tr></table></div><div class="tocviewsublisttop" style="display: block;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1 </td><td><a href="" class="tocviewselflink" data-pltdoc="x">HTTP Client</a></td></tr><tr><td align="right">2 </td><td><a href="url.html" class="tocviewlink" data-pltdoc="x">URLs and HTTP</a></td></tr><tr><td align="right">3 </td><td><a href="uri-codec.html" class="tocviewlink" data-pltdoc="x">URI Codec:<span class="mywbr"> </span> Encoding and Decoding URIs</a></td></tr><tr><td align="right">4 </td><td><a href="websocket.html" class="tocviewlink" data-pltdoc="x">Web<span class="mywbr"> </span>Socket</a></td></tr><tr><td align="right">5 </td><td><a href="ftp.html" class="tocviewlink" data-pltdoc="x">FTP:<span class="mywbr"> </span> Client</a></td></tr><tr><td align="right">6 </td><td><a href="sendurl.html" class="tocviewlink" data-pltdoc="x">Send URL:<span class="mywbr"> </span> Opening a Web Browser</a></td></tr><tr><td align="right">7 </td><td><a href="smtp.html" class="tocviewlink" data-pltdoc="x">SMTP:<span class="mywbr"> </span> Sending E-<wbr></wbr>Mail</a></td></tr><tr><td align="right">8 </td><td><a href="sendmail.html" class="tocviewlink" data-pltdoc="x"><span class="stt">sendmail</span>:<span class="mywbr"> </span> Sending E-<wbr></wbr>Mail</a></td></tr><tr><td align="right">9 </td><td><a href="head.html" class="tocviewlink" data-pltdoc="x">Headers:<span class="mywbr"> </span> Parsing and Constructing</a></td></tr><tr><td align="right">10 </td><td><a href="imap.html" class="tocviewlink" data-pltdoc="x">IMAP:<span class="mywbr"> </span> Reading Mail</a></td></tr><tr><td align="right">11 </td><td><a href="pop3.html" class="tocviewlink" data-pltdoc="x">POP3:<span class="mywbr"> </span> Reading Mail</a></td></tr><tr><td align="right">12 </td><td><a href="mime.html" class="tocviewlink" data-pltdoc="x">MIME:<span class="mywbr"> </span> Decoding Internet Data</a></td></tr><tr><td align="right">13 </td><td><a href="base64.html" class="tocviewlink" data-pltdoc="x">Base 64:<span class="mywbr"> </span> Encoding and Decoding</a></td></tr><tr><td align="right">14 </td><td><a href="qp.html" class="tocviewlink" data-pltdoc="x">Quoted-<wbr></wbr>Printable:<span class="mywbr"> </span> Encoding and Decoding</a></td></tr><tr><td align="right">15 </td><td><a href="dns.html" class="tocviewlink" data-pltdoc="x">DNS:<span class="mywbr"> </span> Domain Name Service Queries</a></td></tr><tr><td align="right">16 </td><td><a href="nntp.html" class="tocviewlink" data-pltdoc="x">NNTP:<span class="mywbr"> </span> Newsgroup Protocol</a></td></tr><tr><td align="right">17 </td><td><a href="tcp.html" class="tocviewlink" data-pltdoc="x">TCP:<span class="mywbr"> </span> Unit and Signature</a></td></tr><tr><td align="right">18 </td><td><a href="tcp-redirect.html" class="tocviewlink" data-pltdoc="x">TCP Redirect:<span class="mywbr"> </span> <span class="RktSym"><span class="RktStxLink">tcp^</span></span> via Channels</a></td></tr><tr><td align="right">19 </td><td><a href="ssl-tcp-unit.html" class="tocviewlink" data-pltdoc="x">SSL Unit:<span class="mywbr"> </span> <span class="RktSym"><span class="RktStxLink">tcp^</span></span> via SSL</a></td></tr><tr><td align="right">20 </td><td><a href="cgi.html" class="tocviewlink" data-pltdoc="x">CGI Scripts</a></td></tr><tr><td align="right">21 </td><td><a href="cookie.html" class="tocviewlink" data-pltdoc="x">Cookie:<span class="mywbr"> </span> HTTP Client Storage</a></td></tr><tr><td align="right"></td><td><a href="doc-bibliography.html" class="tocviewlink" data-pltdoc="x">Bibliography</a></td></tr><tr><td align="right"></td><td><a href="doc-index.html" class="tocviewlink" data-pltdoc="x">Index</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_1");">►</a></td><td>1 </td><td><a href="" class="tocviewselflink" data-pltdoc="x">HTTP Client</a></td></tr></table><div class="tocviewsublistbottom" style="display: none;" id="tocview_1"><table cellspacing="0" cellpadding="0"><tr><td align="right">1.1 </td><td><a href="#%28part._faq%29" class="tocviewlink" data-pltdoc="x">Troubleshooting and Tips</a></td></tr></table></div></div></div><div class="tocsub"><div class="tocsubtitle">On this page:</div><table class="tocsublist" cellspacing="0"><tr><td><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">http-<wbr></wbr>conn?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn-live~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">http-<wbr></wbr>conn-<wbr></wbr>live?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">http-<wbr></wbr>conn</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn-open%21%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">http-<wbr></wbr>conn-<wbr></wbr>open!</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn-open%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">http-<wbr></wbr>conn-<wbr></wbr>open</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn-close%21%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">http-<wbr></wbr>conn-<wbr></wbr>close!</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn-abandon%21%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">http-<wbr></wbr>conn-<wbr></wbr>abandon!</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn-send%21%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">http-<wbr></wbr>conn-<wbr></wbr>send!</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn-recv%21%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">http-<wbr></wbr>conn-<wbr></wbr>recv!</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn-sendrecv%21%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">http-<wbr></wbr>conn-<wbr></wbr>sendrecv!</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-sendrecv%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">http-<wbr></wbr>sendrecv</span></span></a></td></tr><tr><td><span class="tocsublinknumber">1.1<tt> </tt></span><a href="#%28part._faq%29" class="tocsubseclink" data-pltdoc="x">Troubleshooting and Tips</a></td></tr><tr><td><span class="tocsublinknumber">1.1.1<tt> </tt></span><a href="#%28part._.How_do_.I_send_properly_formatted_.P.O.S.T_form_requests_%29" class="tocsubseclink" data-pltdoc="x">How do I send properly formatted POST form requests?</a></td></tr></table></div></div><div class="maincolumn"><div class="main"><div class="navsettop"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "6.1", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.1");">top</a></span><span class="navright"> <a href="index.html" title="backward to "Net: Networking Libraries"" data-pltdoc="x">← prev</a> <a href="index.html" title="up to "Net: Networking Libraries"" data-pltdoc="x">up</a> <a href="url.html" title="forward to "2 URLs and HTTP"" data-pltdoc="x">next →</a></span> </div><h3 x-source-module="(lib "net/scribblings/net.scrbl")" x-part-tag=""http-client"">1<tt> </tt><a name="(part._http-client)"></a><a name="(mod-path._net/http-client)"></a>HTTP Client</h3><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="" class="RktModLink" data-pltdoc="x"><span class="RktSym">net/http-client</span></a><span class="RktPn">)</span></td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">base</span></span></td></tr></table></div><div class="SIntrapara">The <a href="" class="RktModLink" data-pltdoc="x"><span class="RktSym">net/http-client</span></a> library provides
utilities to use the HTTP protocol.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._net/http-client..rkt)._http-conn~3f))"></a><span title="Provided from: net/http-client | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">http-conn?</a></span></span><span class="hspace"> </span><span class="RktVar">x</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">x</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Identifies an HTTP connection.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._net/http-client..rkt)._http-conn-live~3f))"></a><span title="Provided from: net/http-client | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn-live~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">http-conn-live?</a></span></span><span class="hspace"> </span><span class="RktVar">x</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">x</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Identifies an HTTP connection that is "live", i.e. one for which
<span class="RktSym"><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn-send%21%29%29" class="RktValLink" data-pltdoc="x">http-conn-send!</a></span> is valid.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._net/http-client..rkt)._http-conn))"></a><span title="Provided from: net/http-client | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn%29%29" class="RktValDef RktValLink" data-pltdoc="x">http-conn</a></span></span><span class="RktPn"></span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn~3f%29%29" class="RktValLink" data-pltdoc="x">http-conn?</a></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Returns a fresh HTTP connection.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td><span class="RktPn">(</span><a name="(def._((lib._net/http-client..rkt)._http-conn-open!))"></a><span title="Provided from: net/http-client | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn-open%21%29%29" class="RktValDef RktValLink" data-pltdoc="x">http-conn-open!</a></span></span></td><td><span class="hspace"> </span></td><td><span class="RktVar">hc</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktVar">host</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span>[</td><td><span class="RktPn">#:ssl?</span><span class="hspace"> </span><span class="RktVar">ssl?</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:port</span><span class="hspace"> </span><span class="RktVar">port</span>]<span class="RktPn">)</span></td><td><span class="hspace"> </span></td><td>→</td><td><span class="hspace"> </span></td><td><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">void?</a></span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">hc</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn~3f%29%29" class="RktValLink" data-pltdoc="x">http-conn?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">host</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">ssl?</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=openssl&rel=index.html%23%2528def._%2528%2528lib._openssl%252Fmain..rkt%2529._ssl-client-context%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">ssl-client-context?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=symbols.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._symbol%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">symbol?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">port</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._between%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">between/c</a></span><span class="hspace"> </span><span class="RktVal">1</span><span class="hspace"> </span><span class="RktVal">65535</span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=if.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._if%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">if</a></span><span class="hspace"> </span><span class="RktVar">ssl?</span><span class="hspace"> </span><span class="RktVal">443</span><span class="hspace"> </span><span class="RktVal">80</span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Uses <span class="RktVar">hc</span> to connect to <span class="RktVar">host</span> on port <span class="RktVar">port</span>
using SSL if <span class="RktVar">ssl?</span> is not <span class="RktVal">#f</span> (using <span class="RktVar">ssl?</span> as
an argument to <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=openssl&rel=index.html%23%2528def._%2528%2528lib._openssl%252Fmain..rkt%2529._ssl-connect%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">ssl-connect</a></span> to, for example, check
certificates.)</div></p><p>If <span class="RktVar">hc</span> is live, the connection is closed.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td><span class="RktPn">(</span><a name="(def._((lib._net/http-client..rkt)._http-conn-open))"></a><span title="Provided from: net/http-client | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn-open%29%29" class="RktValDef RktValLink" data-pltdoc="x">http-conn-open</a></span></span></td><td><span class="hspace"> </span></td><td><span class="RktVar">host</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span>[</td><td><span class="RktPn">#:ssl?</span><span class="hspace"> </span><span class="RktVar">ssl?</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:port</span><span class="hspace"> </span><span class="RktVar">port</span>]<span class="RktPn">)</span></td><td><span class="hspace"> </span></td><td>→</td><td><span class="hspace"> </span></td><td><span class="RktSym"><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn~3f%29%29" class="RktValLink" data-pltdoc="x">http-conn?</a></span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">host</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">ssl?</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=openssl&rel=index.html%23%2528def._%2528%2528lib._openssl%252Fmain..rkt%2529._ssl-client-context%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">ssl-client-context?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=symbols.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._symbol%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">symbol?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">port</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._between%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">between/c</a></span><span class="hspace"> </span><span class="RktVal">1</span><span class="hspace"> </span><span class="RktVal">65535</span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=if.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._if%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">if</a></span><span class="hspace"> </span><span class="RktVar">ssl?</span><span class="hspace"> </span><span class="RktVal">443</span><span class="hspace"> </span><span class="RktVal">80</span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Calls <span class="RktSym"><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn-open%21%29%29" class="RktValLink" data-pltdoc="x">http-conn-open!</a></span> with a fresh connection, which is returned.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._net/http-client..rkt)._http-conn-close!))"></a><span title="Provided from: net/http-client | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn-close%21%29%29" class="RktValDef RktValLink" data-pltdoc="x">http-conn-close!</a></span></span><span class="hspace"> </span><span class="RktVar">hc</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">void?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">hc</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn~3f%29%29" class="RktValLink" data-pltdoc="x">http-conn?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Closes <span class="RktVar">hc</span> if it is live.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._net/http-client..rkt)._http-conn-abandon!))"></a><span title="Provided from: net/http-client | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn-abandon%21%29%29" class="RktValDef RktValLink" data-pltdoc="x">http-conn-abandon!</a></span></span><span class="hspace"> </span><span class="RktVar">hc</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">void?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">hc</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn~3f%29%29" class="RktValLink" data-pltdoc="x">http-conn?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Closes the output side of <span class="RktVar">hc</span>, if it is live.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td><span class="RktPn">(</span><a name="(def._((lib._net/http-client..rkt)._http-conn-send!))"></a><span title="Provided from: net/http-client | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn-send%21%29%29" class="RktValDef RktValLink" data-pltdoc="x">http-conn-send!</a></span></span></td><td><span class="hspace"> </span></td><td><span class="RktVar">hc</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktVar">uri</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span>[</td><td><span class="RktPn">#:version</span><span class="hspace"> </span><span class="RktVar">version</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:method</span><span class="hspace"> </span><span class="RktVar">method</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:close?</span><span class="hspace"> </span><span class="RktVar">close?</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:headers</span><span class="hspace"> </span><span class="RktVar">headers</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:content-decode</span><span class="hspace"> </span><span class="RktVar">decodes</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:data</span><span class="hspace"> </span><span class="RktVar">data</span>]<span class="RktPn">)</span></td><td><span class="hspace"> </span></td><td>→</td><td><span class="hspace"> </span></td><td><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">void?</a></span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">hc</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn-live~3f%29%29" class="RktValLink" data-pltdoc="x">http-conn-live?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">uri</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">version</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#"1.1"</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">method</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=symbols.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._symbol%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">symbol?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#"GET"</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">close?</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">headers</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528lib._racket%252Flist..rkt%2529._empty%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">empty</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">decodes</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=symbols.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._symbol%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">symbol?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">gzip</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">data</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr></table></blockquote></div><div class="SIntrapara">Sends an HTTP request to <span class="RktVar">hc</span> to the URI <span class="RktVar">uri</span> using
HTTP version <span class="RktVar">version</span> the method <span class="RktVar">method</span> and the
additional headers given in <span class="RktVar">headers</span> and the additional data
<span class="RktVar">data</span>.</div></p><p>If <span class="RktVar">headers</span> does not contain an <span class="RktInBG"><span class="hspace"></span><span class="RktIn">Accept-Encoding</span><span class="hspace"></span></span>
header, then a header indicating that encodings from <span class="RktVar">decodes</span>
are accepted is automatically added.</p><p>If <span class="RktVar">close?</span> is <span class="RktVal">#t</span> and <span class="RktVar">headers</span> does not
contain a <span class="RktInBG"><span class="hspace"></span><span class="RktIn">Connection</span><span class="hspace"></span></span> header, then a <span class="RktInBG"><span class="hspace"></span><span class="RktIn">Connection: close</span><span class="hspace"></span></span> header will be added.</p><p>This function does not support requests that expect
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">100 (Continue)</span><span class="hspace"></span></span> responses.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td><span class="RktPn">(</span><a name="(def._((lib._net/http-client..rkt)._http-conn-recv!))"></a><span title="Provided from: net/http-client | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn-recv%21%29%29" class="RktValDef RktValLink" data-pltdoc="x">http-conn-recv!</a></span></span></td><td><span class="hspace"> </span></td><td><span class="RktVar">hc</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span>[</td><td><span class="RktPn">#:content-decode</span><span class="hspace"> </span><span class="RktVar">decodes</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:close?</span><span class="hspace"> </span><span class="RktVar">close?</span>]<span class="RktPn">)</span></td><td><span class="hspace"> </span></td></tr></table></blockquote></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="prototype"><tr><td><span class="hspace"> </span></td><td>→</td><td><span class="hspace"> </span></td><td><table cellspacing="0" cellpadding="0"><tr><td><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span></td><td><span class="hspace"> </span></td><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="RktPn">)</span></td><td><span class="hspace"> </span></td><td><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=port-ops.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._input-port%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">input-port?</a></span></td></tr></table></td></tr></table></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">hc</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn-live~3f%29%29" class="RktValLink" data-pltdoc="x">http-conn-live?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">decodes</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=symbols.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._symbol%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">symbol?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">gzip</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">close?</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr></table></blockquote></div><div class="SIntrapara">Parses an HTTP response from <span class="RktVar">hc</span>, while decoding the encodings
listed in <span class="RktVar">decodes</span>.</div></p><p>Returns the status line, a list of headers, and an port which contains
the contents of the response.</p><p>If <span class="RktVar">close?</span> is <span class="RktVal">#t</span>, then the connection will be closed
following the response parsing. If <span class="RktVar">close?</span> is <span class="RktVal">#f</span>,
then the connection is only closed if the server instructs the client
to do so.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td><span class="RktPn">(</span><a name="(def._((lib._net/http-client..rkt)._http-conn-sendrecv!))"></a><span title="Provided from: net/http-client | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn-sendrecv%21%29%29" class="RktValDef RktValLink" data-pltdoc="x">http-conn-sendrecv!</a></span></span></td><td><span class="hspace"> </span></td><td><span class="RktVar">hc</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktVar">uri</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span>[</td><td><span class="RktPn">#:version</span><span class="hspace"> </span><span class="RktVar">version</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:method</span><span class="hspace"> </span><span class="RktVar">method</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:headers</span><span class="hspace"> </span><span class="RktVar">headers</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:data</span><span class="hspace"> </span><span class="RktVar">data</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:content-decode</span><span class="hspace"> </span><span class="RktVar">decodes</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:close?</span><span class="hspace"> </span><span class="RktVar">close?</span>]<span class="RktPn">)</span></td><td><span class="hspace"> </span></td></tr></table></blockquote></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="prototype"><tr><td><span class="hspace"> </span></td><td>→</td><td><span class="hspace"> </span></td><td><table cellspacing="0" cellpadding="0"><tr><td><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span></td><td><span class="hspace"> </span></td><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="RktPn">)</span></td><td><span class="hspace"> </span></td><td><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=port-ops.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._input-port%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">input-port?</a></span></td></tr></table></td></tr></table></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">hc</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn-live~3f%29%29" class="RktValLink" data-pltdoc="x">http-conn-live?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">uri</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">version</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#"1.1"</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">method</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=symbols.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._symbol%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">symbol?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#"GET"</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">headers</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528lib._racket%252Flist..rkt%2529._empty%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">empty</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">data</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">decodes</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=symbols.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._symbol%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">symbol?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">gzip</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">close?</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr></table></blockquote></div><div class="SIntrapara">Calls <span class="RktSym"><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn-send%21%29%29" class="RktValLink" data-pltdoc="x">http-conn-send!</a></span> and <span class="RktSym"><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn-recv%21%29%29" class="RktValLink" data-pltdoc="x">http-conn-recv!</a></span> in sequence.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td><span class="RktPn">(</span><a name="(def._((lib._net/http-client..rkt)._http-sendrecv))"></a><span title="Provided from: net/http-client | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-sendrecv%29%29" class="RktValDef RktValLink" data-pltdoc="x">http-sendrecv</a></span></span></td><td><span class="hspace"> </span></td><td><span class="RktVar">host</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktVar">uri</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span>[</td><td><span class="RktPn">#:ssl?</span><span class="hspace"> </span><span class="RktVar">ssl?</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:port</span><span class="hspace"> </span><span class="RktVar">port</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:version</span><span class="hspace"> </span><span class="RktVar">version</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:method</span><span class="hspace"> </span><span class="RktVar">method</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:headers</span><span class="hspace"> </span><span class="RktVar">headers</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:data</span><span class="hspace"> </span><span class="RktVar">data</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:content-decode</span><span class="hspace"> </span><span class="RktVar">decodes</span>]<span class="RktPn">)</span></td><td><span class="hspace"> </span></td></tr></table></blockquote></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="prototype"><tr><td><span class="hspace"> </span></td><td>→</td><td><span class="hspace"> </span></td><td><table cellspacing="0" cellpadding="0"><tr><td><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span></td><td><span class="hspace"> </span></td><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="RktPn">)</span></td><td><span class="hspace"> </span></td><td><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=port-ops.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._input-port%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">input-port?</a></span></td></tr></table></td></tr></table></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">host</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">uri</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">ssl?</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=openssl&rel=index.html%23%2528def._%2528%2528lib._openssl%252Fmain..rkt%2529._ssl-client-context%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">ssl-client-context?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=symbols.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._symbol%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">symbol?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">port</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._between%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">between/c</a></span><span class="hspace"> </span><span class="RktVal">1</span><span class="hspace"> </span><span class="RktVal">65535</span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=if.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._if%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">if</a></span><span class="hspace"> </span><span class="RktVar">ssl?</span><span class="hspace"> </span><span class="RktVal">443</span><span class="hspace"> </span><span class="RktVal">80</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">version</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#"1.1"</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">method</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=symbols.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._symbol%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">symbol?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#"GET"</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">headers</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528lib._racket%252Flist..rkt%2529._empty%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">empty</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">data</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">decodes</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=symbols.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._symbol%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">symbol?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">gzip</span><span class="RktVal">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Calls <span class="RktSym"><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn-send%21%29%29" class="RktValLink" data-pltdoc="x">http-conn-send!</a></span> and <span class="RktSym"><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn-recv%21%29%29" class="RktValLink" data-pltdoc="x">http-conn-recv!</a></span> in
sequence on a fresh HTTP connection produced by
<span class="RktSym"><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn-open%29%29" class="RktValLink" data-pltdoc="x">http-conn-open</a></span>.</div></p><p>The HTTP connection is not returned, so it is always closed after one
response, which is why there is no <span class="RktPn">#:closed?</span> argument like
<span class="RktSym"><a href="#%28def._%28%28lib._net%2Fhttp-client..rkt%29._http-conn-recv%21%29%29" class="RktValLink" data-pltdoc="x">http-conn-recv!</a></span>.</p><h4 x-source-module="(lib "net/scribblings/net.scrbl")" x-part-tag=""faq"">1.1<tt> </tt><a name="(part._faq)"></a>Troubleshooting and Tips</h4><h5 x-source-module="(lib "net/scribblings/net.scrbl")" x-part-tag=""How_do_I_send_properly_formatted_POST_form_requests_"">1.1.1<tt> </tt><a name="(part._.How_do_.I_send_properly_formatted_.P.O.S.T_form_requests_)"></a>How do I send properly formatted POST form requests?</h5><p>You should send a <span class="RktInBG"><span class="hspace"></span><span class="RktIn">Content-Type</span><span class="hspace"></span></span> header with the value
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">application/x-www-form-urlencoded</span><span class="hspace"></span></span> and send the data
formatted by <a href="uri-codec.html" class="RktModLink" data-pltdoc="x"><span class="RktSym">net/uri-codec</span></a>’s
<span class="RktSym"><a href="uri-codec.html#%28def._%28%28lib._net%2Furi-codec..rkt%29._form-urlencoded-encode%29%29" class="RktValLink" data-pltdoc="x">form-urlencoded-encode</a></span> function. For example,</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym">http-send!</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">hc</span><span class="hspace"> </span><span class="RktVal">"/login"</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:method</span><span class="hspace"> </span><span class="RktVal">"POST"</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:data</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="uri-codec.html#%28def._%28%28lib._net%2Furi-codec..rkt%29._alist-~3eform-urlencoded%29%29" class="RktValLink" data-pltdoc="x">alist->form-urlencoded</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">list</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._cons%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">cons</a></span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">username</span><span class="hspace"> </span><span class="RktVal">"Ryu"</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._cons%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">cons</a></span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">password</span><span class="hspace"> </span><span class="RktVal">"Sheng Long"</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:headers</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">list</a></span><span class="hspace"> </span><span class="RktVal">"Content-Type: application/x-www-form-urlencoded"</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><div class="navsetbottom"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "6.1", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.1");">top</a></span><span class="navright"> <a href="index.html" title="backward to "Net: Networking Libraries"" data-pltdoc="x">← prev</a> <a href="index.html" title="up to "Net: Networking Libraries"" data-pltdoc="x">up</a> <a href="url.html" title="forward to "2 URLs and HTTP"" data-pltdoc="x">next →</a></span> </div></div></div><div id="contextindicator"> </div></body></html>
|