Quantcast
Channel: WE MOVED to github.com/microsoft/cpprestsdk. This site is not monitored!
Viewing all articles
Browse latest Browse all 4845

Commented Issue: Content-type is parsed incorrectly for atom feeds [213]

$
0
0
According to http://www.ietf.org/rfc/rfc5023.txt Content-type of atom feeds can looks like this:

application/atom+xml; charset=UTF-8; type=entry or application/atom+xml; type=entry; charset=UTF-8

This is perfectly legal textual body, however web::http::details::parse_content_type_and_charset can't parse such a string and http_msg_base::_extract_string() throws http_exception(textual_content_type_missing)
Comments: Hi vitalijskr, Yes I see what you mean. Our Content-Type and charset detection for extract_string and extract_json isn't perfect. Between examples like what you mention and other content types I recently added the ability to force extract_string and extract_json. It is in the development branch and will be included in the next release. ``` /// <summary> /// Extract the body of the request message as a string value, checking that the content type is a MIME text type. /// A body can only be extracted once because in some cases an optimization is made where the data is 'moved' out. /// </summary> /// <param name="force">If true, ignores the Content-Type header and assumes UTF-8.</param> /// <returns>String containing body of the message.</returns> pplx::task<utility::string_t> extract_string(bool force = false) ``` I'm not sure that we will be improve parse_content_type_and_charset to handle the case you mention, but if you feel strongly we gladly accept contributions and would welcome a fix. Thanks, Steve

Viewing all articles
Browse latest Browse all 4845


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>