MCPcopy Create free account
hub / github.com/acl-dev/acl / set_charset_conv

Method set_charset_conv

lib_acl_cpp/src/http/http_request.cpp:726–765  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

724}
725
726void http_request::set_charset_conv()
727{
728 if (client_ == NULL || local_charset_[0] == 0) {
729 return;
730 }
731
732 // ��Ҫ�����Ӧͷ�ַ�����Ϣ
733 const char* ptr = client_->header_value("Content-Type");
734 if (ptr == NULL || *ptr == 0) {
735 return;
736 }
737
738#if !defined(ACL_MIME_DISABLE)
739
740 http_ctype ctype;
741 ctype.parse(ptr);
742
743 const char* from_charset = ctype.get_charset();
744
745 if (from_charset == NULL || *from_charset == 0
746 || strcasecmp(from_charset, local_charset_) == 0) {
747
748 return;
749 }
750
751 // ��ʼ���ַ���ת����
752
753 if (conv_ == NULL) {
754 conv_ = charset_conv::create(from_charset, local_charset_);
755 }
756 // ����֮ǰ�������ַ���ת����
757 else if (!conv_->update_begin(from_charset, local_charset_)) {
758 logger_error("invalid charset conv, from %s, to %s",
759 from_charset, local_charset_);
760 delete conv_;
761 conv_ = NULL;
762 }
763
764#endif // !defined(ACL_MIME_DISABLE)
765}
766
767http_pipe* http_request::get_pipe(const char* to_charset)
768{

Callers

nothing calls this directly

Calls 5

get_charsetMethod · 0.80
createFunction · 0.50
header_valueMethod · 0.45
parseMethod · 0.45
update_beginMethod · 0.45

Tested by

no test coverage detected