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