Changes between Initial Version and Version 1 of Ticket #18072, comment 4


Ignore:
Timestamp:
Jun 6, 2014, 12:30:42 PM (6 years ago)
Author:
tsofist
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #18072, comment 4

    initial v1  
    88
    99Taking all of the above, It seems to me this code has never worked correctly and requires changes that I've suggested above.
    10 
    11 A simple example with a Russian site, as a demonstration of the problem:
    12 {{{
    13 #!div style="font-size: 90%"
    14 Code highlighting:
    15   {{{#!javascript
    16         var options = {
    17             host: "habrahabr.ru",
    18             port: 80,
    19             path: "/company/knopka/blog/225027/",
    20             method: "POST"
    21         };
    22 
    23         var mCharPattern = /�/g;
    24 
    25         var reqBad = http.request(options, function(res) {
    26             console.log("\n*** [BAD REQUEST] ***\n", "\nSTATUS: " + res.statusCode, "\nHEADERS: " + JSON.stringify(res.headers));
    27             var data = [];
    28             res.on("data", function (chunk) {
    29                 data.push(chunk);
    30             });
    31             res.on("end", function () {
    32                 var res = "";
    33                 data.forEach(function (item) {
    34                     res += item.toString("utf8");
    35                 });
    36                 console.log("CHUNKS: ", data.length, "\nDATA LEN: ", res.length);
    37                 var matchRes = res.match(mCharPattern);
    38