ืฉื—ืจื•ืจ ืฉืœ nginx 1.19.3 ื•-njs 0.4.4

ื ื•ืฆืจ ืฉื—ืจื•ืจ ื‘ืžืขืœื” ื”ื–ืจื 1.19.3, ืฉื‘ืชื•ื›ื• ื ืžืฉืš ื”ืคื™ืชื•ื— ืฉืœ ื™ื›ื•ืœื•ืช ื—ื“ืฉื•ืช (ื‘ืžืงื‘ื™ืœ ื ืชืžืš ื™ืฆื™ื‘ ืกื ื™ืฃ 1.18 ืžืชื‘ืฆืขื™ื ืจืง ืฉื™ื ื•ื™ื™ื ื”ืงืฉื•ืจื™ื ืœื‘ื™ื˜ื•ืœ ืฉื’ื™ืื•ืช ื•ืคื’ื™ืขื•ื™ื•ืช ื—ืžื•ืจื•ืช).

ื”ืขื™ืงืจื™ ืฉื™ื ื•ื™ื™ื:

  • ื”ืžื•ื“ื•ืœ ื›ืœื•ืœ ngx_stream_set_module, ื”ืžืืคืฉืจ ืœื”ืงืฆื•ืช ืขืจืš ืœืžืฉืชื ื”

    ืฉืจืช {
    ืœื”ืงืฉื™ื‘ 12345;
    ื”ื’ื“ืจ $true 1;
    }

  • ื ื•ืกืคื” ื”ื ื—ื™ื” proxy_cookie_flags ื›ื“ื™ ืœืฆื™ื™ืŸ ื“ื’ืœื™ื ืขื‘ื•ืจ ืงื•ื‘ืฆื™ Cookie ื‘ื—ื™ื‘ื•ืจื™ ืคืจื•ืงืกื™. ืœื“ื•ื’ืžื”, ื›ื“ื™ ืœื”ื•ืกื™ืฃ ืืช ื”ื“ื’ืœ "httponly" ืœ-Cookie "one", ื•ืืช ื”ื“ื’ืœื™ื "nosecure" ื•-"samesite=strict" ืขื‘ื•ืจ ื›ืœ ืฉืืจ ื”ืขื•ื’ื™ื•ืช, ืืชื” ื™ื›ื•ืœ ืœื”ืฉืชืžืฉ ื‘ืžื‘ื ื” ื”ื‘ื:

    proxy_cookie_flags ืื—ื“ httponly;
    proxy_cookie_flags ~ nosecure samesite=strict;

  • ื”ื ื—ื™ื” ื“ื•ืžื” userid_flags ืขื‘ื•ืจ ื”ื•ืกืคืช ื“ื’ืœื™ื ืœ-Cookie ืžื™ื•ืฉื ื’ื ืขื‘ื•ืจ ื”ืžื•ื“ื•ืœ ngx_http_userid.

ื‘ื• ื–ืžื ื™ืช ื”ืชืงื™ื™ื ืกื•ื’ื™ื” njs 0.4.4, ืžืชื•ืจื’ืžืŸ JavaScript ืขื‘ื•ืจ ืฉืจืช ื”ืื™ื ื˜ืจื ื˜ nginx. ืžืชื•ืจื’ืžืŸ njs ืžื™ื™ืฉื ืชืงื ื™ ECMAScript ื•ืžืืคืฉืจ ืœืš ืœื”ืจื—ื™ื‘ ืืช ื”ื™ื›ื•ืœืช ืฉืœ nginx ืœืขื‘ื“ ื‘ืงืฉื•ืช ื‘ืืžืฆืขื•ืช ืกืงืจื™ืคื˜ื™ื ื‘ืชืฆื•ืจื”. ื ื™ืชืŸ ืœื”ืฉืชืžืฉ ื‘ืกืงืจื™ืคื˜ื™ื ื‘ืงื•ื‘ืฅ ืชืฆื•ืจื” ื›ื“ื™ ืœื”ื’ื“ื™ืจ ืœื•ื’ื™ืงื” ืžืชืงื“ืžืช ืœืขื™ื‘ื•ื“ ื‘ืงืฉื•ืช, ื™ืฆื™ืจืช ืชืฆื•ืจื”, ื™ืฆื™ืจื” ื“ื™ื ืžื™ืช ืฉืœ ืชื’ื•ื‘ื”, ืฉื™ื ื•ื™ ื‘ืงืฉื”/ืชื’ื•ื‘ื”, ืื• ื™ืฆื™ืจื” ืžื”ื™ืจื” ืฉืœ ืงื˜ืขื™ื ืœืคืชืจื•ืŸ ื‘ืขื™ื•ืช ื‘ื™ื™ืฉื•ืžื™ ืื™ื ื˜ืจื ื˜. ื‘ื’ืจืกื” ื”ื—ื“ืฉื”:

  • ื ื•ืกืคื” ืชืžื™ื›ื” ื‘ื”ืคืจื“ื” ื—ื–ื•ืชื™ืช ืฉืœ ืกืคืจื•ืช ื‘ืžืกืคืจื™ื (ืœื“ื•ื’ืžื”, "1_000").
  • ื”ื˜ืžื™ืขื• ืฉื™ื˜ื•ืช ื—ืกืจื•ืช ืขื‘ื•ืจ %TypedArray%. ืื‘-ื˜ื™ืคื•ืก: every(), filter(), find(), findIndex(), forEach(), include(), indexOf(), lastIndexOf(), map(), reduce(), reduceRight(), reverse(), some().
  • ื”ื˜ืžื™ืขื• ืฉื™ื˜ื•ืช ื—ืกืจื•ืช ืขื‘ื•ืจ %TypedArray%: from(), of().
  • ืื•ื‘ื™ื™ืงื˜ DataView ืžื™ื•ืฉื.

    : >> (ื—ื“ืฉ DataView(buf.buffer)).getUint16()
    : 32974

  • ืื•ื‘ื™ื™ืงื˜ Buffer ืžื™ื•ืฉื.

    : >> var buf = Buffer.from([0x80,206,177,206,178])
    : ืœื ืžื•ื’ื“ืจ
    : >> buf.slice(1).toString()
    : 'ฮฑฮฒ'
    : >> buf.toString('base64')
    : 'gM6xzrI='

  • ื”ื•ืกื™ืคื” ืชืžื™ื›ืช ืื•ื‘ื™ื™ืงื˜ Buffer ืœืฉื™ื˜ื•ืช "ืงืจื™ืคื˜ื•" ื•-"fs", ื•ื”ื‘ื˜ื™ื—ื” ืฉ-fs.readFile(), Hash.prototype.digest() ื•-Hmac.prototype.digest() ื”ื—ื–ื™ืจื• ืžื•ืคืข ืฉืœ ื”ืื•ื‘ื™ื™ืงื˜ Buffer.
  • ืชืžื™ื›ืช ArrayBuffer ื ื•ืกืคื” ืœืฉื™ื˜ืช TextDecoder.prototype.decode()โ€Ž.

ืžืงื•ืจ: OpenNet.ru

ื”ื•ืกืคืช ืชื’ื•ื‘ื”