<div class="gmail_quote"><br>On Sun, Dec 13, 2009 at 5:20 AM, ccwu <span dir="ltr">&lt;<a href="mailto:ccwu660601@gmail.com">ccwu660601@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Ok, now I know the answer.<br>
I&#39;ve thought that (http-&gt;get url) returns an input-port, but it<br>
returns an http-client-response instead.<br><br></blockquote></div><br>Correct.  http-get returns http-client-response, which wraps over both the headers and a pure input-port (without the headers).  You can use http-client-response-headers to retrieve the headers, which are key/value pairs, and you can retrieve the response as an input port to retrieve and manipulate the body.  Use close-input-port when you are done so the TCP connection can be released. <br>
<br>Below is an example repl session.  Cheers,<br>yc<br><br>Welcome to DrScheme, version 4.2.1 [3m].<br>Language: Module; memory limit: 128 megabytes.<br>&gt; (require (planet bzlib/http))<br>&gt; (define response (http-get &quot;<a href="http://www.google.com/">http://www.google.com/</a>&quot;))<br>
|(reader #&lt;input-port:<a href="http://www.google.com">www.google.com</a>&gt;)<br>|&quot;HTTP/1.0 200 OK&quot;<br>&gt; response<br>#&lt;http-client-response&gt;<br>&gt; (http-client-response-headers response)<br>((&quot;X-XSS-Protection&quot; . &quot;0&quot;)<br>
 (&quot;Server&quot; . &quot;gws&quot;)<br> (&quot;Set-Cookie&quot;<br>  .<br>  &quot;NID=29=UrP_GBX8LIjMuHubAxlXD5Uzo2m1tz5GqvJaZqq8tLPbo5kkcg56DT5BgeKLtN3WyYqbcMSJwzZWQC5T8ONvj68FSJRf2ehC8SXyl63pDlgLuP5lMpElmcCRKbsCDn_i; expires=Mon, 14-Jun-2010 17:47:24 GMT; path=/; domain=.<a href="http://google.com">google.com</a>; HttpOnly&quot;)<br>
 (&quot;Set-Cookie&quot;<br>  .<br>  &quot;PREF=ID=1453ea3d4dd38bd4:TM=1260726444:LM=1260726444:S=Gdsq2rwddhYWBX1N; expires=Tue, 13-Dec-2011 17:47:24 GMT; path=/; domain=.<a href="http://google.com">google.com</a>&quot;)<br>
 (&quot;Content-Type&quot; . &quot;text/html; charset=ISO-8859-1&quot;)<br> (&quot;Cache-Control&quot; . &quot;private, max-age=0&quot;)<br> (&quot;Expires&quot; . &quot;-1&quot;)<br> (&quot;Date&quot; . &quot;Sun, 13 Dec 2009 17:47:24 GMT&quot;))<br>
&gt; (read-bytes 2048 response)<br>#&quot;&lt;!doctype html&gt;&lt;html&gt;&lt;head&gt;&lt;meta http-equiv=\&quot;content-type\&quot; content=\&quot;text/html; charset=ISO-8859-1\&quot;&gt;&lt;title&gt;Google&lt;/title&gt;&lt;script&gt;window.google={kEI:\&quot;rCglS_TNGZrkpgSZt-XeCQ\&quot;,kEXPI:\&quot;17259,22452,23061,23129,23179\&quot;,kCSI:{e:\&quot;17259,22452,23061,23129,23179\&quot;,ei:\&quot;rCglS_TNGZrkpgSZt-XeCQ\&quot;},kHL:\&quot;en\&quot;,time:function(){return(new Date).getTime()},log:function(b,d,c){var a=new Image,e=google,g=<a href="http://e.lc">e.lc</a>,f=<a href="http://e.li">e.li</a>;a.onerror=(a.onload=(a.onabort=function(){delete g[f]}));g[f]=a;c=c||\&quot;/gen_204?atyp=i&amp;ct=\&quot;+b+\&quot;&amp;cad=\&quot;+d+\&quot;&amp;zx=\&quot;+google.time();a.src=c;<a href="http://e.li">e.li</a>=f+1},lc:[],li:0};\<a href="http://nwindow.google.sn">nwindow.google.sn</a>=\&quot;webhp\&quot;;window.google.timers={load:{t:{start:(new Date).getTime()}}};try{}catch(u){}window.google.jsrt_kill=1;\nvar _gjwl=location;function _gjuc(){var e=_gjwl.href.indexOf(\&quot;#\&quot;);if(e&gt;=0){var a=_gjwl.href.substring(e);if(a.indexOf(\&quot;&amp;q=\&quot;)&gt;0||a.indexOf(\&quot;#q=\&quot;)&gt;=0){a=a.substring(1);if(a.indexOf(\&quot;#\&quot;)==-1){for(var c=0;c&lt;a.length;){var d=c;if(a.charAt(d)==\&quot;&amp;\&quot;)++d;var b=a.indexOf(\&quot;&amp;\&quot;,d);if(b==-1)b=a.length;var f=a.substring(d,b);if(f.indexOf(\&quot;fp=\&quot;)==0){a=a.substring(0,c)+a.substring(b,a.length);b=c}else if(f==\&quot;cad=h\&quot;)return 0;c=b}_gjwl.href=\&quot;/search?\&quot;+a+\&quot;&amp;cad=h\&quot;;return 1}}}return 0}function _gjp(){!(window._gjwl.hash&amp;&amp;\nwindow._gjuc())&amp;&amp;setTimeout(_gjp,500)};\nwindow._gjp &amp;&amp; _gjp()&lt;/script&gt;&lt;style&gt;td{line-height:.8em;}.gac_m td{line-height:17px;}form{margin-bottom:20px;}body,td,a,p,.h{font-family:arial,sans-serif}.h{color:#36c;font-size:20px}.q{color:#00c}.ts td{padding:0}.ts{border-collapse:collapse}em{font-weight:bold;font-style:normal}.lst{font:17px arial,sans-serif;margin-bottom:.2em;vertical-align:bottom;}input{font-family:inherit}.lsb,.gac_sb{font-size:15px;height:1.85em!important;margin:.2em;}#gbar{float:left;height:22px}.gbh,.gbd{border-top:1px solid #c9d7f1;font-size:1px}.gbh{height:0;position:absolute;top:24px;width:100%}#gbs,.gbm{background:#fff;left:0;position:absolute;text-align:left;visibility:hidden;z-index:1000}.gbm{border:1px solid;border-color:#c9d7f1 #36c #36c #a2bae7;z-index:1001}#guser{padding-bottom:7px !important;text-align:right}#gbar,#guser{font-siz&quot;<br>
&gt; (close-input-port response)<br>&gt; <br><br><br><br>