{"id":95353,"date":"2020-03-23T17:07:31","date_gmt":"2020-03-23T09:07:31","guid":{"rendered":"http:\/\/4563.org\/?p=95353"},"modified":"2020-03-23T17:07:31","modified_gmt":"2020-03-23T09:07:31","slug":"%e5%bc%ba%e5%a4%a7%e7%9a%84-v-%e5%8f%8b%e4%bb%ac%ef%bc%8c%e9%97%ae%e4%b8%aa%e9%97%ae%e9%a2%98%e6%80%8e%e6%a0%b7%e4%bb%8e%e7%ac%ac%e4%b8%89%e6%96%b9%e8%8e%b7%e5%8f%96%e6%96%87%e4%bb%b6%e5%88%86","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=95353","title":{"rendered":"\u5f3a\u5927\u7684 v \u53cb\u4eec\uff0c\u95ee\u4e2a\u95ee\u9898:\u600e\u6837\u4ece\u7b2c\u4e09\u65b9\u83b7\u53d6\u6587\u4ef6\u5206\u7247\u4f20\u9012\u7ed9\u524d\u7aef golang"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u5f3a\u5927\u7684 v \u53cb\u4eec\uff0c\u95ee\u4e2a\u95ee\u9898:\u600e\u6837\u4ece\u7b2c\u4e09\u65b9\u83b7\u53d6\u6587\u4ef6\u5206\u7247\u4f20\u9012\u7ed9\u524d\u7aef golang               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : airplayxcom <\/span>  <span><i><\/i> 66<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\">                        \u5206\u7247\u83b7\u53d6\u5bb9\u6613\u5b9e\u73b0\uff0c\u600e\u4e48\u5206\u7247\u7ed9\u524d\u7aef\u5462\uff1f<br \/>\u5b9e\u73b0\u9759\u6001\u670d\u52a1\u5668\u7684\u65b9\u5f0f\u524d\u63d0\u662f\u540e\u7aef\u5f62\u6210\u4e86\u8fd9\u4e2a\u6574\u4f53\u6587\u4ef6\u53cd\u7ed9\u524d\u7aef\u3002\u6211\u60f3\u505a\u7684\u662f\u4e00\u8fb9\u4ece\u6e90\u7aef\u83b7\u53d6\u4e00\u8fb9\u53cd\u7ed9\u524d\u7aef\u3002      <\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>10<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"806209\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : BlackBerry999 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u534f\u7a0b+channel \uff1f \u6216\u8005 socket \uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"806210\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Leigg <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e3a\u4f55\u4e0d\u8ba9\u524d\u7aef\u76f4\u63a5\u8c03\u7528\u4e09\u65b9\u63a5\u53e3\uff0c\u51cf\u5c11\u6545\u969c\u70b9\uff0c\u662f\u6709\u4ec0\u4e48\u7ecf\u8fc7\u540e\u53f0\u7684\u5fc5\u8981\u6027\uff1f\u5982\u679c\u6709\uff0c\u6700\u597d\u5148\u7f13\u5b58\u540e\u53f0\uff0c\u7f13\u5b58\u5b8c\u6210\u540e\u518d\u4f20\u524d\u7aef\uff0c\u8fd9\u6837\u6210\u529f\u7387\u66f4\u5927\u4e9b\uff0c\u5927\u6587\u4ef6\u66f4\u751a\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"806211\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : airplayxcom <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @Leigg \u662f\u7684 \u5fc5\u987b\u8d70\u540e\u7aef\u6388\u6743\uff0c\u7f13\u5b58\u5927\u6587\u4ef6\u4e0d\u5403\u5185\u5b58\u5417\uff0c\u51e0\u4e2a\u4eba\u540c\u65f6\u4e0b\u8f7d\u53d1\u6587\u4ef6\u600e\u4e48\u529e\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"806212\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : puyo <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5148 head \u62ff\u5230 contentLength\uff0c\u8fd4\u56de\u5934\u4fe1\u606f\uff0c\u7136\u540e\u5e76\u53d1\u53bb\u7b2c\u4e09\u65b9\u4e0b\u8f7d\uff0c\u6309\u987a\u5e8f flush\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"806213\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Leigg <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @airplayxcom \u7f13\u5b58\u5e76\u4e0d\u4e00\u5b9a\u5c31\u662f\u5b58\u5185\u5b58\u3002\u540e\u53f0\u6574\u4e00\u6bb5\u78c1\u76d8\u7a7a\u95f4\u7528\u6765\u7f13\u5b58\u4e0b\u8f7d\u6587\u4ef6\uff0c\u53ea\u505a\u4e34\u65f6\u7f13\u5b58\uff0c\u4e0b\u5b8c\u5c31\u5220\uff0c\u6216\u8005\u4fdd\u7559\u4e00\u6bb5\u65f6\u95f4\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"806214\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : index90 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             http.HandleFunc(&#8220;&#8221;, func(writer http.ResponseWriter, request *http.Request) {<br \/> file, err := os.Open(&#8220;&#8221;)<br \/> if err != nil {<br \/> writer.WriteHeader(404)<br \/> return<br \/> }<br \/> defer file.Close()<br \/> if _, err := io.Copy(writer, file); err != nil {<br \/> writer.WriteHeader(500)<br \/> return<br \/> }<br \/> writer.Header().Set(&#8220;content-type&#8221;, &#8220;text\/plain&#8221;)<br \/> writer.WriteHeader(200)<br \/> })                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"806215\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : index90 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5982\u679c\u4f60\u4e0d\u662f\u8bfb\u53d6\u672c\u5730\u6587\u4ef6\uff0c\u800c\u662f\u4ece\u522b\u4eba\u7684\u8bf7\u6c42\u4e2d\u8f6c\u53d1\u6570\u636e\uff0c\u4f60\u7559\u610f\u4e00\u4e0b http.Response \u7684 body \u662f\u5df2\u7ecf\u5b9e\u73b0\u4e86 reader interface\uff0c\u53ea\u9700\u8981\u4ece reader copy \u6570\u636e\u5230 writer \u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n<p>\u9762\u5411\u63a5\u53e3\u7f16\u7a0b\uff0c\u4f60\u9700\u8981\u4ec0\u4e48\u63a5\u53e3\uff0c\u53bb\u627e\u5bf9\u5e94\u7684\u5b9e\u73b0\u5c31\u53ef\u4ee5\u4e86\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"806216\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : index90 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             #6 \u7684\u4ee3\u7801\u4e0d\u5bf9\uff0csend header \u5e94\u8be5\u5728 send body \u4e4b\u524d\u3002<br \/> http.HandleFunc(&#8220;&#8221;, func(writer http.ResponseWriter, request *http.Request) {<br \/> var reader io.Reader<br \/> \/\/{<br \/> \/\/ file, err := os.Open(&#8220;&#8221;)<br \/> \/\/ if err != nil {<br \/> \/\/ writer.WriteHeader( http.StatusNotFound)<br \/> \/\/ return<br \/> \/\/ }<br \/> \/\/ reader = file<br \/> \/\/ defer file.Close()<br \/> \/\/}<br \/> {<br \/> resp, err := http.Client{}.Get(&#8220;&#8221;)<br \/> if err != nil {<br \/> writer.WriteHeader( http.StatusNotFound)<br \/> return<br \/> }<br \/> reader = resp.Body<br \/> }<br \/> writer.Header().Set(&#8220;content-type&#8221;, &#8220;text\/plain&#8221;)<br \/> _, _ = io.Copy(writer, reader)<br \/> return<br \/> })                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"806217\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : airplayxcom <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @index90 \u6709\u5fc3\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"806218\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ihciah <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e0d\u4e00\u5b9a\u975e\u8981\u5148\u5168\u62fc\u51fa\u6765\uff0c\u53ef\u4ee5\u6d41\u5f0f\u5904\u7406\uff0c\u5177\u4f53\u5b9e\u73b0\u53ef\u4ee5\u6309\u7167\u4e0a\u7684\u76f4\u63a5\u7528 Reader \u63a5\u53e3\u3002\u81ea\u5df1\u5b9e\u73b0 Reader \u63a5\u53e3\u7684\u8bdd\uff0c\u5728 read \u7684\u65f6\u5019\u73b0\u573a\u62fc\u63a5\u4e0b\u4e00\u5757\u8fd4\u56de\u5c31\u884c\u4e86\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u5f3a\u5927\u7684 v \u53cb\u4eec\uff0c\u95ee\u4e2a\u95ee\u9898:\u600e\u6837\u4ece&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/95353"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=95353"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/95353\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=95353"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=95353"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=95353"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}