<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2016-09-16 23:15 GMT+08:00 Chris Muller <span dir="ltr">&lt;<a href="mailto:asqueaker@gmail.com" target="_blank">asqueaker@gmail.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Xin, I&#39;m sure this will sound odd, but I decided to keep as much of<br>
Andreas&#39; original code intact.<br>
<br>
He may have simply meant, *not* binary, html is expressed in plain<br>
text.  But, you are right that this creates a sort of ambiguity with<br>
the &quot;text/plain&quot; MIME type.<br>
<br>
Best,<br>
  Chris<br>
<div class="HOEnZb"><div class="h5"><br></div></div></blockquote><div><br></div><div>Get it. Thanks!<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
On Thu, Sep 15, 2016 at 10:48 PM, Xin Wang &lt;<a href="mailto:dram.wang@gmail.com">dram.wang@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt;<br>
&gt; 2016-09-16 6:22 GMT+08:00 &lt;<a href="mailto:commits@source.squeak.org">commits@source.squeak.org</a>&gt;:<br>
&gt;&gt;<br>
&gt;&gt; Chris Muller uploaded a new version of WebClient-HTTP to project The<br>
&gt;&gt; Trunk:<br>
&gt;&gt; <a href="http://source.squeak.org/trunk/WebClient-HTTP-cmm.6.mcz" rel="noreferrer" target="_blank">http://source.squeak.org/<wbr>trunk/WebClient-HTTP-cmm.6.mcz</a><br>
&gt;&gt;<br>
&gt;&gt; ==================== Summary ====================<br>
&gt;&gt;<br>
&gt;&gt; Name: WebClient-HTTP-cmm.6<br>
&gt;&gt; Author: cmm<br>
&gt;&gt; Time: 14 September 2016, 3:27:23.768768 pm<br>
&gt;&gt; UUID: 900bff82-5c5e-478b-a08a-<wbr>1ba7736a074d<br>
&gt;&gt; Ancestors: WebClient-HTTP-cmm.4<br>
&gt;&gt;<br>
&gt;&gt; Accept text/html by default only when the user has not specified their own<br>
&gt;&gt; mimeType.<br>
&gt;&gt;<br>
&gt;&gt; =============== Diff against WebClient-HTTP-cmm.4 ===============<br>
&gt;&gt;<br>
&gt;&gt; Item was changed:<br>
&gt;&gt;   ----- Method: HTTPSocket class&gt;&gt;httpGetDocument:args:<wbr>accept:request: (in<br>
&gt;&gt; category &#39;*webclient-http&#39;) -----<br>
&gt;&gt;   httpGetDocument: url args: args accept: mimeType request: requestString<br>
&gt;&gt;         &quot;Return the exact contents of a web object. Asks for the given<br>
&gt;&gt; MIME type. If mimeType is nil, use &#39;text/html&#39;. An extra requestString may<br>
&gt;&gt; be submitted and must end with crlf.  The parsed header is saved. Use a<br>
&gt;&gt; proxy server if one has been registered.  tk 7/23/97 17:12&quot;<br>
&gt;&gt;<br>
&gt;&gt;         &quot;Note: To fetch raw data, you can use the MIME type<br>
&gt;&gt; &#39;application/octet-stream&#39;.&quot;<br>
&gt;&gt;<br>
&gt;&gt;         | client xhdrs resp urlString progress |<br>
&gt;&gt;         &quot;Normalize the url&quot;<br>
&gt;&gt;         urlString := (Url absoluteFromText: url) asString.<br>
&gt;&gt;<br>
&gt;&gt;         args ifNotNil: [<br>
&gt;&gt;                 urlString := urlString, (self argString: args)<br>
&gt;&gt;         ].<br>
&gt;&gt;<br>
&gt;&gt;         &quot;Some raw extra headers which historically have been added&quot;<br>
&gt;&gt;         xhdrs := HTTPProxyCredentials,<br>
&gt;&gt;                 HTTPBlabEmail,  &quot;may be empty&quot;<br>
&gt;&gt;                 requestString.  &quot;extra user request. Authorization&quot;<br>
&gt;&gt;<br>
&gt;&gt;         client := WebClient new.<br>
&gt;&gt;         ^[resp := client httpGet: urlString do:[:req|<br>
&gt;&gt; +               &quot;Add ACCEPT header, accept plain text by default.&quot;<br>
&gt;&gt; +               req headerAt: &#39;Accept&#39; put: (mimeType ifNil:<br>
&gt;&gt; [&#39;text/html&#39;]).<br>
&gt;&gt; -               &quot;Add ACCEPT header&quot;<br>
&gt;&gt; -               mimeType ifNotNil:[req headerAt: &#39;Accept&#39; put: mimeType].<br>
&gt;&gt;<br>
&gt;&gt; -               &quot;Always accept plain text&quot;<br>
&gt;&gt; -               req addHeader: &#39;Accept&#39; value: &#39;text/html&#39;.<br>
&gt;&gt; -<br>
&gt;&gt;                 &quot;Add the additional headers&quot;<br>
&gt;&gt;                 (WebUtils readHeadersFrom: xhdrs readStream)<br>
&gt;&gt;                         do:[:assoc| req addHeader: assoc key value: assoc<br>
&gt;&gt; value]].<br>
&gt;&gt;<br>
&gt;&gt;         progress := [:total :amount|<br>
&gt;&gt;                 (HTTPProgress new) total: total; amount: amount; signal:<br>
&gt;&gt; &#39;Downloading...&#39;<br>
&gt;&gt;         ].<br>
&gt;&gt;<br>
&gt;&gt;         &quot;Simulate old HTTPSocket return behavior&quot;<br>
&gt;&gt;         (resp code between: 200 and: 299)<br>
&gt;&gt;                 ifTrue:[MIMEDocument contentType: resp contentType<br>
&gt;&gt;                                 content: (resp contentWithProgress:<br>
&gt;&gt; progress) url: url]<br>
&gt;&gt;                 ifFalse:[resp asString, resp content].<br>
&gt;&gt;         ] ensure:[client destroy].<br>
&gt;&gt;   !<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt; Comment typo?<br>
&gt;<br>
&gt; I think “text/html&quot; does not mean &quot;plain text&quot;, as there is &quot;text/plain&quot;.<br>
&gt;<br>
&gt;<br>
&gt; Regards,<br>
&gt; Xin Wang<br>
&gt;<br>
&gt;<br>
&gt;<br>
<br>
</div></div></blockquote></div><br></div></div>