{"id":277090,"date":"2023-07-20T09:00:38","date_gmt":"2023-07-20T01:00:38","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=277090"},"modified":"2023-07-13T10:59:01","modified_gmt":"2023-07-13T02:59:01","slug":"njs-0-8","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/njs-0-8.html","title":{"rendered":"Njs 0.8.0\u53d1\u5e03"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nNjs 0.8.0\u53d1\u5e03,\u5206\u4e3anginx\u6a21\u5757\u548c\u6838\u5fc3\u8fdb\u884c\u4ecb\u7ecd\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"<\/p>\n

nginx\u6a21\u5757<\/strong><\/div>\n
    \n
  1. \u66f4\u6539\uff1a\u5220\u9664\u4e860.7.10\u7248\u672c\u4e2d\u5f15\u5165\u7684Fetch API\u4e2d\u5bf9\u7981\u6b62\u7684\u5934\u4fe1\u606f\u7684\u7279\u6b8a\u5904\u7406\u3002<\/li>\n
  2. \u66f4\u6539\uff1a\u5220\u9664\u4e86http\u6a21\u5757\u4e2d\u81ea0.5.0\u4ee5\u6765\u5e9f\u5f03\u7684r.requestBody()\u548cr.responseBody()\u3002<\/li>\n
  3. \u66f4\u6539\uff1a\u5728http\u6a21\u5757\u4e2d\u8fc7\u6ee4\u65f6\uff0c\u5728r.internalRedirect()\u4e2d\u629b\u51fa\u4e00\u4e2a\u5f02\u5e38\u3002<\/li>\n
  4. \u7279\u6027\uff1a\u5f15\u5165\u5168\u5c40nginx\u5c5e\u6027\uff1angx.build\u3001ngx.conf_file_path\u3001ngx.error_log_path\u3001ngx.prefix\u3001ngx.version\u3001ngx.version_number\u548cngx.worker_id\u3002<\/li>\n
  5. \u7279\u6027\uff1a\u4e3a http \u548c stream \u5f15\u5165\u4e86 js_shared_dict_zone \u6307\u4ee4\uff0c\u5141\u8bb8\u58f0\u660e\u5de5\u4f5c\u8fdb\u7a0b\u4e4b\u95f4\u5171\u4eab\u7684\u5b57\u5178\u3002<\/li>\n
  6. \u6539\u8fdb\uff1a\u589e\u52a0\u4e86\u7981\u7528njs\u6a21\u5757\u7684\u7f16\u8bd1\u65f6\u9009\u9879\u3002\u4f8b\u5982\uff0c\u7981\u7528libxslt\u76f8\u5173\u4ee3\u7801\uff1a\n
    NJS_LIBXSLT=NO .\/configure .\u2013add-module=\/path\/to\/njs\/module<\/pre>\n<\/li>\n
  7. \u9519\u8bef\u4fee\u6b63\uff1a\u4fee\u590d\u4e86http\u6a21\u5757\u4e2d\u8fc7\u6ee4\u65f6\u7684r.status\u8bbe\u7f6e\u5668\u3002<\/li>\n
  8. \u9519\u8bef\u4fee\u6b63\uff1a\u4fee\u6b63\u4e86http\u6a21\u5757\u4e2dLocation\u5934\u7684\u8bbe\u7f6e\u3002<\/li>\n<\/ol>\n
    \u6838\u5fc3<\/strong><\/div>\n
      \n
    1. \u66f4\u6539\uff1a\u672c\u5730\u65b9\u6cd5\u63d0\u4f9b\u4e86retval\u53c2\u6570\u3002\u8fd9\u4e00\u53d8\u5316\u7834\u574f\u4e86\u4e0eNJS\u7684C\u6269\u5c55\u7684\u517c\u5bb9\u6027\uff0c\u9700\u8981\u4fee\u6539\u4ee3\u7801\u3002<\/li>\n
    2. \u66f4\u6539\uff1a\u5220\u9664\u4e86\u4e0d\u7b26\u5408\u8981\u6c42\u7684\u5e9f\u5f03\u7684String\u65b9\u6cd5\u3002\u4ee5\u4e0b\u65b9\u6cd5\u5df2\u88ab\u5220\u9664\uff1aString.bytesFrom(), String.prototype.fromBytes(), String.prototype.fromUTF8(), String.prototype.toBytes(), String.prototype.toUTF8(), String.prototype.toString\uff08encoding\uff09\u3002<\/li>\n
    3. \u66f4\u6539\uff1a\u5220\u9664\u5bf9\u4f7f\u7528GNU readline\u6784\u5efa\u7684\u652f\u6301\u3002<\/li>\n
    4. \u7279\u6027\uff1a\u6dfb\u52a0\u4e86\u7b26\u5408ES13\u6807\u51c6\u7684\u6570\u7ec4\u65b9\u6cd5\uff1aArray.from(), Array.prototype.toSorted(), Array.prototype.toSpliced(), Array.prototype.toReversed()\u3002<\/li>\n
    5. \u7279\u6027\uff1a\u589e\u52a0\u4e86\u7b26\u5408ES13\u6807\u51c6\u7684TypedArray\u65b9\u6cd5\uff1a%TypedArray%.prototype.toSorted(), %TypedArray%.prototype.toSpliced(), %TypedArray%.prototype.toReversed()\u3002<\/li>\n
    6. \u7279\u6027\uff1a\u5728WebCrypto API\u4e2d\u589e\u52a0\u4e86CryptoKey\u5c5e\u6027\u3002\u589e\u52a0\u4e86\u4ee5\u4e0b\u5c5e\u6027\uff1a\u7b97\u6cd5\u3001\u53ef\u63d0\u53d6\u3001\u7c7b\u578b\u3001\u7528\u9014\u3002<\/li>\n
    7. \u9519\u8bef\u4fee\u6b63\uff1a\u4fee\u6b63\u4e86\u0441rypto.getRandomValues()\u7684retval\u3002<\/li>\n
    8. \u9519\u8bef\u4fee\u6b63\uff1a\u4fee\u6b63\u4e86\u7528\u51fd\u6570\u8868\u8fbe\u5f0f\u8ba1\u7b97\u7684\u5c5e\u6027\u540d\u79f0\u7684\u8bc4\u4f30\u3002<\/li>\n
    9. \u9519\u8bef\u4fee\u6b63\uff1a\u4fee\u6b63\u4e86\u5728\u6570\u7ec4\u4e2d\u58f0\u660e\u7684\u51fd\u6570\u8868\u8fbe\u5f0f\u7684\u9690\u542b\u540d\u79f0\u3002<\/li>\n
    10. \u9519\u8bef\u4fee\u6b63\uff1a\u4fee\u6b63\u4e86for-in\u5faa\u73af\u7684\u89e3\u6790\u95ee\u9898\u3002<\/li>\n
    11. \u9519\u8bef\u4fee\u6b63\uff1a\u4fee\u6b63\u4e86Date.parse()\u7684ISO-8601\u683c\u5f0f\u548cUTC\u65f6\u95f4\u504f\u79fb\u3002<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"

      \u66f4\u6539\uff1a\u5220\u9664\u4e860.7.10\u7248\u672c\u4e2d\u5f15\u5165\u7684Fetch API\u4e2d\u5bf9\u7981\u6b62\u7684\u5934\u4fe1\u606f\u7684\u7279\u6b8a\u5904\u7406\u3002 \u66f4\u6539\uff1a\u5220\u9664\u4e86http\u6a21\u5757\u4e2d […]<\/p>\n","protected":false},"author":1481,"featured_media":277092,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[21],"tags":[],"class_list":["post-277090","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/277090","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1481"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=277090"}],"version-history":[{"count":3,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/277090\/revisions"}],"predecessor-version":[{"id":277302,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/277090\/revisions\/277302"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/277092"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=277090"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=277090"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=277090"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}