久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <legend id='14gSn'><style id='14gSn'><dir id='14gSn'><q id='14gSn'></q></dir></style></legend>
  • <i id='14gSn'><tr id='14gSn'><dt id='14gSn'><q id='14gSn'><span id='14gSn'><b id='14gSn'><form id='14gSn'><ins id='14gSn'></ins><ul id='14gSn'></ul><sub id='14gSn'></sub></form><legend id='14gSn'></legend><bdo id='14gSn'><pre id='14gSn'><center id='14gSn'></center></pre></bdo></b><th id='14gSn'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='14gSn'><tfoot id='14gSn'></tfoot><dl id='14gSn'><fieldset id='14gSn'></fieldset></dl></div>

      1. <tfoot id='14gSn'></tfoot>
          <bdo id='14gSn'></bdo><ul id='14gSn'></ul>

        <small id='14gSn'></small><noframes id='14gSn'>

        正確處理 SSL_shutdown

        Handling SSL_shutdown correctly(正確處理 SSL_shutdown)

        1. <legend id='wZNBw'><style id='wZNBw'><dir id='wZNBw'><q id='wZNBw'></q></dir></style></legend>
          <i id='wZNBw'><tr id='wZNBw'><dt id='wZNBw'><q id='wZNBw'><span id='wZNBw'><b id='wZNBw'><form id='wZNBw'><ins id='wZNBw'></ins><ul id='wZNBw'></ul><sub id='wZNBw'></sub></form><legend id='wZNBw'></legend><bdo id='wZNBw'><pre id='wZNBw'><center id='wZNBw'></center></pre></bdo></b><th id='wZNBw'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='wZNBw'><tfoot id='wZNBw'></tfoot><dl id='wZNBw'><fieldset id='wZNBw'></fieldset></dl></div>
            <tfoot id='wZNBw'></tfoot>
              <bdo id='wZNBw'></bdo><ul id='wZNBw'></ul>

                <tbody id='wZNBw'></tbody>
            • <small id='wZNBw'></small><noframes id='wZNBw'>

                • 本文介紹了正確處理 SSL_shutdown的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  關于 SSL_shutdown 的 OpenSSL 文檔指出:

                  The OpenSSL documentation on SSL_shutdown states that:

                  因此建議檢查SSL_shutdown()的返回值并再次調用SSL_shutdown(),如果雙向關閉尚未完成(返回值第一個調用是 0).

                  It is therefore recommended, to check the return value of SSL_shutdown() and call SSL_shutdown() again, if the bidirectional shutdown is not yet complete (return value of the first call is 0).

                  https://www.openssl.org/docs/ssl/SSL_shutdown.html

                  我在下面有一個代碼片段,我在其中檢查 SSL_shutdown 的返回值 0 并再次調用它,我一直在使用它.我的問題是,是否可以在第二次調用時忽略 SSL_shutdown 的返回值,或者我們應該繼續重試 SSL_shutdown 直到返回 1(雙向關閉完成).

                  I have a code snippet below where I check for return value 0 from SSL_shutdown and call it again, which I have been using. My question is, is it okay to disregard the return value of SSL_shutdown on the second call or we should keep retrying SSL_shutdown until a 1 (bidirectional shutdown complete) is returned.

                  int r = SSL_shutdown(ssl);
                  //error handling here if r < 0 
                  if(!r)
                  {
                      shutdown(fd,1);
                      SSL_shutdown(ssl); //how should I handle return value and error handling here is it required?? 
                  }
                  SSL_free(ssl);
                  SSLMap.erase(fd);
                  shutdown(fd,2);
                  close(fd);
                  

                  推薦答案

                  openssl 有點像黑暗藝術.

                  openssl is a bit of a dark art.

                  首先,您引用的頁面對返回值進行了 HTML 化處理.這是手冊頁實際上所說的:

                  Firstly the page you referenced has HTML-ified the return values badly. Here's what the man-page actually says:

                    RETURN VALUES
                  
                     The following return values can occur:
                  
                     0   The shutdown is not yet finished. Call SSL_shutdown() for a second
                         time, if a bidirectional shutdown shall be performed.  The output
                         of SSL_get_error(3) may be misleading, as an erroneous
                         SSL_ERROR_SYSCALL may be flagged even though no error occurred.
                  
                     1   The shutdown was successfully completed. The "close notify" alert
                         was sent and the peer's "close notify" alert was received.
                  
                     -1  The shutdown was not successful because a fatal error occurred
                         either at the protocol level or a connection failure occurred. It
                         can also occur if action is need to continue the operation for non-
                         blocking BIOs.  Call SSL_get_error(3) with the return value ret to
                         find out the reason.
                  

                  如果您有阻塞 BIO,事情就相對簡單了.第一次調用時為 0 意味著如果您想要完全雙向關閉,則需要再次調用 SSL_shutdown.基本上這意味著您發送了 close_notify 警報但還沒有回復).1 表示您之前收到了來自其他對等方的 close_notify 警報,并且您已經完全完成了.-1 表示不可恢復的錯誤.在第二次調用時(只有在返回 0 時才這樣做),然后啟動雙向關閉(即現在等待對方向您發送close_notify"警報).邏輯決定你不能再得到一個 0(因為它是一個阻塞的 BIO 并且已經完成了第一步).-1 表示錯誤,1 表示完成成功.

                  If you have blocking BIOs, things are relatively simple. A 0 on the first call means you need to call SSL_shutdown again if you want a full bidirectional shutdown. Basically it means that you sent a close_notify alert but haven't one back yet). A 1 would mean you previously received a close_notify alert from the other peer, and you're totally done. A -1 means an unrecoverable error. On the second call (which you only do if you got a 0 back), then a bidirectional shutdown is initiated (i.e. now wait from the other side for them to send you their "close_notify" alert). Logic dictates you can't get a 0 back again (because it's a blocking BIO and will have completed the first step). A -1 indicates an error, and a 1 indicates completion success.

                  如果你有非阻塞 BIO,同樣的可能是 0 然后 1"的返回值適用,除了你需要遍歷整個 SSL_ERROR_WANT_READSSL_ERROR_WANT_WRITE 也很啰嗦,即:

                  If you have non-blocking BIOs, the same "possibly 0 then 1" return values apply, save for the fact you need to go through the whole SSL_ERROR_WANT_READ and SSL_ERROR_WANT_WRITE rigmarole as well, i.e.:

                     If the underlying BIO is non-blocking, SSL_shutdown() will also return
                     when the underlying BIO could not satisfy the needs of SSL_shutdown()
                     to continue the handshake. In this case a call to SSL_get_error() with
                     the return value of SSL_shutdown() will yield SSL_ERROR_WANT_READ or
                     SSL_ERROR_WANT_WRITE. The calling process then must repeat the call
                     after taking appropriate action to satisfy the needs of SSL_shutdown().
                     The action depends on the underlying BIO. When using a non-blocking
                     socket, nothing is to be done, but select() can be used to check for
                     the required condition. When using a buffering BIO, like a BIO pair,
                     data must be written into or retrieved out of the BIO before being able
                     to continue.
                  

                  所以你有兩個級別的重復.您在第一次"調用 SSL_shutdown,但如果在繞過 select()SSL_ERROR_WANT_WRITE 后得到 SSL_ERROR_WANT_READSSL_ERROR_WANT_WRITE,請重復> 以正常方式循環,如果您得到非 SSL_ERROR_WANT_ 錯誤代碼(在這種情況下它失敗),則僅將第一個"SSL_shutdown 視為已完成,或者您得到01 返回.如果你得到 1 返回,你就完成了.如果您得到 0 返回,并且您想要雙向關閉,那么您必須進行第二次調用,再次需要檢查 SSL_ERROR_WANT_READSSL_ERROR_WANT_WRITE 并重試選擇;不應返回 1,但可能返回 0 或錯誤.

                  So you have two levels of repetition. You call SSL_shutdown the 'first' time but repeat if you get SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE after going around the select() loop in the normal way, and only count the 'first' SSL_shutdown as done if you get a non SSL_ERROR_WANT_ error code (in which case it failed), or you get a 0 or 1 return. If you get a 1 return, you've done. If you get a 0 return, and you want a bidirectional shutdown, then you have to do the second call, on which again you will need to check for SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE and retry select; that should not return 1, but may return 0 or an error.

                  不簡單.

                  來自 docs 的更多注釋:調用 之后SSL_shutdown 并在第一次返回0"時,您可以選擇調用 SSL_read 而不是 SSL_shutdown(以防對等方仍在向您發送任何數據在那個 SSL 套接字上),并且我猜希望"他們最終從他們這邊向您發送關閉消息,以刷新管道.

                  Couple more notes from the docs: after calling SSL_shutdown and getting a "0" back the first time, you could optionally then call SSL_read instead of SSL_shutdown (in case the peer is still sending you any data on that SSL socket), and, I guess, "hope" that they eventually send you a close message from their side, to flush the pipes.

                  此外,如果您計劃在關閉完成后無論如何"關閉套接字,您可以完全跳過對 SSL_shutdown(0 然后 1"的1")的第二次調用,然后只需繼續關閉套接字,內核應該注意丟棄現在被忽略"的 close_notify 警報,大概他們應該發送...

                  Also if you're planning on closing the socket after shutdown completion "anyway" you could entirely skip the second call to SSL_shutdown (the "1" of the "0 then 1") and just go ahead and close the socket, the kernel should take care of discarding the "now ignored" close_notify alert that presumably they should be about to send...

                  這篇關于正確處理 SSL_shutdown的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Why do two functions have the same address?(為什么兩個函數的地址相同?)
                  Why the initializer of std::function has to be CopyConstructible?(為什么 std::function 的初始化程序必須是可復制構造的?)
                  mixing templates with polymorphism(混合模板與多態性)
                  When should I use the keyword quot;typenamequot; when using templates(我什么時候應該使用關鍵字“typename?使用模板時)
                  Dependent name resolution amp; namespace std / Standard Library(依賴名稱解析命名空間 std/標準庫)
                  gcc can compile a variadic template while clang cannot(gcc 可以編譯可變參數模板,而 clang 不能)
                  • <bdo id='EU42O'></bdo><ul id='EU42O'></ul>

                    <small id='EU42O'></small><noframes id='EU42O'>

                        <tbody id='EU42O'></tbody>
                      <tfoot id='EU42O'></tfoot>

                      • <i id='EU42O'><tr id='EU42O'><dt id='EU42O'><q id='EU42O'><span id='EU42O'><b id='EU42O'><form id='EU42O'><ins id='EU42O'></ins><ul id='EU42O'></ul><sub id='EU42O'></sub></form><legend id='EU42O'></legend><bdo id='EU42O'><pre id='EU42O'><center id='EU42O'></center></pre></bdo></b><th id='EU42O'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='EU42O'><tfoot id='EU42O'></tfoot><dl id='EU42O'><fieldset id='EU42O'></fieldset></dl></div>
                        • <legend id='EU42O'><style id='EU42O'><dir id='EU42O'><q id='EU42O'></q></dir></style></legend>

                          1. 主站蜘蛛池模板: 国产羞羞视频在线观看 | 日日操网站 | 91免费在线| 最新国产精品精品视频 | 免费一级欧美在线观看视频 | 日韩在线观看一区二区三区 | 天天弄| 国产精品亚洲一区二区三区在线 | 国产精品1区 | 中文字幕综合 | 在线电影日韩 | 亚洲一区在线日韩在线深爱 | 一级二级三级黄色 | 丁香六月伊人 | 中文字幕日韩在线 | av网站观看 | 欧美日韩一区在线 | 成人妇女免费播放久久久 | 亚洲国产成人久久久 | 天天插天天操 | 台湾a级理论片在线观看 | 天天干天天插 | 国产区在线免费观看 | 欧美日韩国产传媒 | 人碰人操| 日韩中文在线视频 | 精品国产乱码久久久久久蜜臀 | 日韩欧美一级片 | 免费天天干 | 日韩一区二区三区精品 | 国产一区二区在线免费播放 | 一级黄色片在线免费观看 | 91精品国产综合久久福利软件 | 自拍偷拍第一页 | 色综合99 | 亚洲风情在线观看 | 日韩一区二区三区在线视频 | 精品一区国产 | 国产精品a久久久久 | 亚洲电影第三页 | 欧美韩一区二区三区 |