{"id":317,"date":"2025-11-02T20:28:51","date_gmt":"2025-11-02T12:28:51","guid":{"rendered":"https:\/\/www.garfield-blog.top\/?p=317"},"modified":"2025-11-02T20:29:20","modified_gmt":"2025-11-02T12:29:20","slug":"openwrt%e6%9e%b6%e6%9e%84%e9%a1%b5%e9%9d%a2%e4%b8%8a%e4%bc%a0%e4%b8%8b%e8%bd%bd%e6%96%87%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/www.garfield-blog.top\/?p=317","title":{"rendered":"\u3010\u6e90\u7801\u89e3\u6790\u3011openwrt\u67b6\u6784\u9875\u9762\u4e0a\u4f20\u4e0b\u8f7d\u6587\u4ef6"},"content":{"rendered":"\n<p><code>openwrt<\/code>\u67b6\u6784\u5728<code>web<\/code>\u9875\u9762\u63a5\u53e3\u5c06\u6587\u4ef6\u7684\u5bfc\u51fa\u5bfc\u5165\uff0c\u4f8b\u5982\u56fa\u4ef6\u5347\u7ea7\uff0c\u914d\u7f6e\u6587\u4ef6\u5bfc\u51fa\u5bfc\u5165\uff1b\u4e3b\u8981\u6d41\u7a0b\u5982\u4e0b<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u5728<code>js<\/code>\u4e0a\u521b\u5efa\u4e00\u4e2a<code>from<\/code>\u8868\u5355\uff0c\u8868\u5355\u4e2d\u643a\u5e26\u7740\u6587\u4ef6\u4f20\u8f93\u7684\u8bf7\u6c42<\/li>\n\n\n\n<li><code>uhttp<\/code>\u6a21\u5757\u5904\u7406\u8fd9\u4e2a\u8bf7\u6c42\uff0c\u5728<code>\/rom\/www\/cgi-bin<\/code>\u76ee\u5f55\u4e0b\u53bb\u5bfb\u627e\u5bf9\u5e94\u7684\u63a5\u53e3<\/li>\n\n\n\n<li>\u5e95\u5c42<code>cgi-io<\/code>\u6a21\u5757\u5b9e\u73b0\u5177\u4f53\u4e1a\u52a1<\/li>\n<\/ol>\n\n\n\n<p>\u6574\u4f53\u6d41\u7a0b\u5982\u4e0b\u56fe<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.garfield-blog.top\/wp-content\/uploads\/2025\/11\/OpenWrt\u67b6\u6784\u5bfc\u51fa\u5bfc\u5165\u6587\u4ef6-1024x137.jpg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"137\" data-original=\"https:\/\/www.garfield-blog.top\/wp-content\/uploads\/2025\/11\/OpenWrt\u67b6\u6784\u5bfc\u51fa\u5bfc\u5165\u6587\u4ef6-1024x137.jpg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" class=\"wp-image-318\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/div><\/figure>\n\n\n\n<p>\u4ee5\u4e0b\u7528\u914d\u7f6e\u6587\u4ef6\u5bfc\u51fa\u4e3e\u4f8b<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">js\u4ee3\u7801<\/h2>\n\n\n\n<p>\u4ee3\u7801\u8def\u5f84\uff1a<code>package\/feeds\/luci\/luci-mod-system\/htdocs\/luci-static\/resources\/view\/system\/backup.js<\/code><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>handleBackup: function() {\n    var thit= this;\n    return thit.handleCreartBackup().then(function(){\n        var form = E('form', {\n            method: 'post',\n            action: L.env.cgi_base + '\/cgi-backup',\n            enctype: 'application\/x-www-form-urlencoded'\n        }, E('input', { type: 'hidden', name: 'sessionid', value: rpc.getSessionID() }));\n\n        var div = document.querySelector('#view');\n        div.appendChild(form);\n\n        form.submit();\n        form.parentNode.removeChild(form);\n    });\n},<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">uhttpd\u6a21\u5757<\/h2>\n\n\n\n<p><code>uhttpd<\/code>\u5728<code>\/rom\/www\/cgi-bin<\/code>\u76ee\u5f55\u4e0b\u8c03\u7528\u5bf9\u5e94<code>cgi<\/code>\u63a5\u53e3<\/p>\n\n\n\n<p>\u4ee3\u7801\u8def\u5f84\uff1a<code>build_dir\/target-arm\/uhttpd-2020-10-01-3abcc891\/main.c<\/code><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ \u521d\u59cb\u5316cgi\u63a5\u53e3\u8def\u5f84\nstatic void init_defaults_pre(void)\n{\n    conf.script_timeout = 60;\n    conf.network_timeout = 30;\n    conf.http_keepalive = 20;\n    conf.max_script_requests = 3;\n    conf.max_connections = 100;\n    conf.realm = \"Protected Area\";\n    conf.cgi_prefix = \"\/cgi-bin\";\n    conf.cgi_path = \"\/sbin:\/usr\/sbin:\/bin:\/usr\/bin\";\n    INIT_LIST_HEAD(&amp;conf.cgi_alias);\n    INIT_LIST_HEAD(&amp;conf.lua_prefix);\n}<\/code><\/pre>\n\n\n\n<p>\u67e5\u770b<code>uhttp<\/code>\u76f8\u5173\u914d\u7f6e\u6587\u4ef6\u53ef\u4ee5\u627e\u5230\u8fd9\u4e2a\u5b57\u6bb5\u7684\u542b\u4e49<\/p>\n\n\n\n<p>\u4ee3\u7801\u8def\u5f84\uff1a<code>build_dir\/target-arm\/uhttpd-2020-10-01-3abcc891\/.pkgdir\/uhttpd\/etc\/config\/uhttpd<\/code><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># CGI url prefix, will be searched in docroot.\n# Default is \/cgi-bin\noption cgi_prefix    \/cgi-bin<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">cgi-io\u6a21\u5757<\/h2>\n\n\n\n<p><code>cig-io<\/code>\u6a21\u5757\u5b9e\u9645\u4e0a\u4e3b\u8981\u662f\u5b9e\u73b0\u4e1a\u52a1\u4e0a\u7684\u903b\u8f91\uff0c\u6309\u7167\u4e1a\u52a1\u8981\u6c42\u5c06\u6570\u636e\u83b7\u53d6\u540e\u5199\u5165\u5230\u81ea\u8eab\u8fdb\u7a0b\u7684\u6807\u51c6\u8f93\u51fa\u4e2d\uff0c\u6b64\u5904\u8be6\u7ec6\u4ee3\u7801\u7701\u7565\uff1b<\/p>\n\n\n\n<p><strong>\u7531\u6b64\u53ef\u4ee5\u65ad\u5b9a\u6d4f\u89c8\u5668\u4e0ecgi-io\u4e4b\u95f4\u8fd8\u6709\u4e00\u4e2a\u4e2d\u95f4\u5c42\u5373uhttpd<\/strong><\/p>\n\n\n\n<p><strong>\u7f16\u8bd1\u4ea7\u7269<\/strong><\/p>\n\n\n\n<p><code>cgi-io<\/code>\u6a21\u5757\u7f16\u8bd1\u4ea7\u7269\u4e0e\u81ea\u8eab\u540c\u540d\u4e5f\u53eb<code>cgi-io<\/code>\uff0c\u540c\u65f6\u4f1a\u521b\u5efa\u6570\u4e2a\u8f6f\u8fde\u63a5\u6307\u5411\u8fd9\u4e2a\u7f16\u8bd1\u4ea7\u7269<\/p>\n\n\n\n<p>\u4ee3\u7801\u8def\u5f84\uff1a<code>package\/feeds\/packages\/cgi-io\/Makefile<\/code><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>define Package\/cgi-io\/install\n    $(INSTALL_DIR) $(1)\/usr\/libexec $(1)\/www\/cgi-bin\/\n    $(INSTALL_BIN) $(PKG_BUILD_DIR)\/cgi-io $(1)\/usr\/libexec\n    $(LN) ..\/..\/usr\/libexec\/cgi-io $(1)\/www\/cgi-bin\/cgi-upload\n    $(LN) ..\/..\/usr\/libexec\/cgi-io $(1)\/www\/cgi-bin\/cgi-download\n    $(LN) ..\/..\/usr\/libexec\/cgi-io $(1)\/www\/cgi-bin\/cgi-backup\n    $(LN) ..\/..\/usr\/libexec\/cgi-io $(1)\/www\/cgi-bin\/cgi-exportlogs\n    $(LN) ..\/..\/usr\/libexec\/cgi-io $(1)\/www\/cgi-bin\/cgi-tarlogs\n    $(LN) ..\/..\/usr\/libexec\/cgi-io $(1)\/www\/cgi-bin\/cgi-exec\nendef<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>openwrt\u67b6\u6784\u5728web\u9875\u9762\u63a5\u53e3\u5c06\u6587\u4ef6\u7684\u5bfc\u51fa\u5bfc\u5165\uff0c\u4f8b\u5982\u56fa\u4ef6\u5347\u7ea7\uff0c\u914d\u7f6e\u6587\u4ef6\u5bfc\u51fa\u5bfc\u5165\uff1b\u4e3b\u8981\u6d41\u7a0b\u5982\u4e0b \u6574\u4f53\u6d41\u7a0b\u5982\u4e0b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-317","post","type-post","status-publish","format-standard","hentry","category-source-code-analysis"],"_links":{"self":[{"href":"https:\/\/www.garfield-blog.top\/index.php?rest_route=\/wp\/v2\/posts\/317","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.garfield-blog.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garfield-blog.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garfield-blog.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garfield-blog.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=317"}],"version-history":[{"count":2,"href":"https:\/\/www.garfield-blog.top\/index.php?rest_route=\/wp\/v2\/posts\/317\/revisions"}],"predecessor-version":[{"id":320,"href":"https:\/\/www.garfield-blog.top\/index.php?rest_route=\/wp\/v2\/posts\/317\/revisions\/320"}],"wp:attachment":[{"href":"https:\/\/www.garfield-blog.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=317"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garfield-blog.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=317"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garfield-blog.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=317"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}