-
-
[原创]发些个人库之string_cc.cc
-
发表于:
2013-10-7 13:04
5761
-
主要用来格式化HTTP协议的,代码写的很烂,比不上string和CString,还望被批斗。
版权问题:Author: root的意思是Linux Root账户
用法:
bool setResponse::content_type(const char* str) {
const char* mime = http::matchMime::getInstance().find_ext_name_mime(str);
setResponse::str_.format("Content-Type: %s\r\n", mime);
return true;
}
bool setResponse::content_encode() {
setResponse::str_.append("Content-Encoding: deflate\r\n");
return true;
}
bool setResponse::content_length(size_t len) {
setResponse::str_.format("Content-Length: %ld\r\n", len);
return true;
}
void setResponse::cache_control() {
setResponse::str_.append("Cache-Control: no-cache\r\n");
}
bool setResponse::transfer_encoding() {
setResponse::str_.append("Transfer-Encoding: chunked\r\n");
return true;
}
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!