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

Method http_mime

lib_acl_cpp/src/http/http_mime.cpp:120–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118//////////////////////////////////////////////////////////////////////////
119
120http_mime::http_mime(const char* boundary,
121 const char* local_charset /* = "gb2312" */) {
122 assert(boundary && *boundary);
123 boundary_ = boundary;
124
125 if (local_charset && *local_charset) {
126 safe_snprintf(local_charset_, sizeof(local_charset_),
127 "%s", local_charset);
128 } else {
129 local_charset_[0] = 0;
130 }
131
132 decode_on_ = true;
133
134 save_path_.clear();
135 mime_state_ = mime_state_alloc();
136
137 static const char ctype_pre[] =
138 "Content-Type: multipart/form-data; boundary=";
139
140 // Ϊ��ʹ���ʼ��� mime ����������Ҫģ���һ��ͷ���ֶ�
141 mime_state_update(mime_state_, ctype_pre, sizeof(ctype_pre) - 1);
142 size_t len = strlen(boundary);
143 mime_state_update(mime_state_, boundary, (int) len);
144 mime_state_update(mime_state_, "\r\n\r\n", 4);
145
146 // ��Ϊ��ͷ��Ϊ����������ͷ�Ƕ���ӽ�ȥ�ģ����Ի����ʵ�ʵ�ƫ������
147 // ͨ�� off_ ������ƫ��������
148 off_ = 0 - ((long long) sizeof(ctype_pre) - 1 + (long long) len + 4);
149
150 parsed_ = false;
151}
152
153http_mime::~http_mime() {
154 if (mime_state_) {

Callers

nothing calls this directly

Calls 4

safe_snprintfFunction · 0.85
mime_state_allocFunction · 0.85
mime_state_updateFunction · 0.85
clearMethod · 0.45

Tested by

no test coverage detected