We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
switch (ret) { //其他case略 case FILE_REQUEST: { add_status_line(200, ok_200_title); if (m_file_stat.st_size != 0) { add_headers(m_file_stat.st_size); m_iv[0].iov_base = m_write_buf; m_iv[0].iov_len = m_write_idx; m_iv[1].iov_base = m_file_address; m_iv[1].iov_len = m_file_stat.st_size; m_iv_count = 2; bytes_to_send = m_write_idx + m_file_stat.st_size; return true; } else { const char *ok_string = "<html><body></body></html>"; add_headers(strlen(ok_string)); if (!add_content(ok_string)) return false; } } default: return false; }
http_conn.cpp的第690行,也就是if (!add_content(ok_string))return false; 后面是不是少了个break,要不然当add_content()为真时会直接跳到default里去,正常来说应该break到循环外返回true
The text was updated successfully, but these errors were encountered:
经测试,是错的。 代码如下
#include<iostream> using namespace std; bool process_write() { int ret = 3; switch (ret){ case 3: if (0) return true; else if (0) return false; default: cout << "default" << endl; return false; } } int main() { cout << process_write() << endl; }
Sorry, something went wrong.
我也觉得是少了个break
No branches or pull requests
http_conn.cpp的第690行,也就是if (!add_content(ok_string))return false; 后面是不是少了个break,要不然当add_content()为真时会直接跳到default里去,正常来说应该break到循环外返回true
The text was updated successfully, but these errors were encountered: