Compare Revisions

The credentials to download the source code are:
 Username: svnusers
 Password: svnusers

Ignore whitespace Rev 3337 → Rev 3338

/branches/STF525/ccsrc/Protocols/Http/http_codec.cc
131,8 → 131,18
const LibItsHttp__MessageBodyTypes::HttpMessageBody& body = static_cast<const LibItsHttp__MessageBodyTypes::HttpMessageBody&>(*v.get_opt_value());
loggers::get_instance().log_msg("http_codec::encode_request: body: ", body);
if (encode_body(body, os) == -1) {
loggers::get_instance().warning("http_codec::encode_request: Failed to encode HTTP body");
_ec.length = 0;
_ec.is_content_length_present = 0x00;
} else {
_ec.length = os.lengthof();
_ec.is_content_length_present = 0x01;
}
loggers::get_instance().log("http_codec::encode_request: length=%d", _ec.length);
} else {
loggers::get_instance().log("http_codec::encode_request: HTTP body field not present");
_ec.length = 0;
_ec.is_content_length_present = 0x00;
}
 
// Encode generic part
151,13 → 161,15
loggers::get_instance().log_msg("http_codec::encode_request: Processing header ", header.header__name());
p_encoding_buffer.put_cs(header.header__name());
p_encoding_buffer.put_cs(": ");
if (std::string(static_cast<const char*>(header.header__name())).compare("Content-Length") == 0) {
if (std::string(static_cast<const char*>(header.header__name())).compare("Content-length") == 0) {
if (_ec.length != 0) {
p_encoding_buffer.put_cs(int2str(_ec.length + 2/*Stand for the last CRLF*/));
_ec.is_content_length_present = 0x01;
} else {
p_encoding_buffer.put_cs("0");
_ec.is_content_length_present = 0x00;
}
_ec.is_content_length_present = 0x01;
loggers::get_instance().log("http_codec::encode_request: Content-length: %d - %x", _ec.length, _ec.is_content_length_present);
} else {
const OPTIONAL<LibItsHttp__TypesAndValues::charstring__list>& o = header.header__value();
if (o.ispresent()) {
179,7 → 191,8
} // End of 'for' statement
 
p_encoding_buffer.put_cs("\r\n");
if (_ec.length != 0) {
if (_ec.is_content_length_present == 0x01) {
loggers::get_instance().log_msg("http_codec::encode_request: Add body ", os);
p_encoding_buffer.put_os(os);
p_encoding_buffer.put_cs("\r\n");
}