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

Method sendHeader

lib_acl_cpp/src/http/HttpServletResponse.cpp:153–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151}
152
153bool HttpServletResponse::sendHeader(void)
154{
155 if (head_sent_) {
156 return true;
157 }
158 head_sent_ = true;
159
160 acl_assert(header_->is_request() == false);
161
162 char buf[256];
163 if (charset_[0] != 0) {
164 safe_snprintf(buf, sizeof(buf), "%s; charset=%s",
165 content_type_, charset_);
166 } else {
167 safe_snprintf(buf, sizeof(buf), "%s", content_type_);
168 }
169
170 header_->set_content_type(buf);
171
172 // ��Ȼ���������Ӧͷ�������� gzip ѹ����ʽ�����������˲�����
173 // gzip ѹ�����ݣ�����Ҫ����Ӧͷ�н�ֹ
174 if (header_->is_transfer_gzip() && request_) {
175 bool accept_gzip = false;
176 std::vector<string> tokens;
177 request_->getAcceptEncoding(tokens);
178 std::vector<string>::const_iterator it;
179
180 for (it = tokens.begin(); it != tokens.end(); ++it) {
181 if ((*it).compare("gzip", false) == 0) {
182 accept_gzip = true;
183 break;
184 }
185 }
186
187 if (!accept_gzip) {
188 header_->set_transfer_gzip(false);
189 }
190 }
191
192 return client_->write_head(*header_);
193}
194
195bool HttpServletResponse::write(const void* data, size_t len)
196{

Callers 15

doUnknownMethod · 0.80
doUnknownMethod · 0.80
doUnknownMethod · 0.80
doUnknownMethod · 0.80
doErrorMethod · 0.80
doUnknownMethod · 0.80
doErrorMethod · 0.80
doUnknownMethod · 0.80
doUnknownMethod · 0.80
doOtherMethod · 0.80
doPostMethod · 0.80
doResponseMethod · 0.80

Calls 8

safe_snprintfFunction · 0.85
is_requestMethod · 0.80
set_content_typeMethod · 0.80
getAcceptEncodingMethod · 0.80
beginMethod · 0.80
compareMethod · 0.80
endMethod · 0.45
write_headMethod · 0.45

Tested by

no test coverage detected