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

Commented Issue: Linux: "chunked" detection logic doesn't work in all cases [2]

$
0
0
in read_headers (http_client.cpp):

ctx->m_needChunked = boost::iequals(value, U("chunked"));

Above statement will not always work because some site somehow inserts an additional space before the "chunked"

test:

www.cnn.com, "chunked"
news.cnet.com, " chunked"

A dummy workaround (didn't know how to easily trim):

ctx->m_needChunked = boost::iequals(value, U("chunked")); //original
if(!ctx->m_needChunked)
ctx->m_needChunked = boost::iequals(value, U(" chunked")); //additional check

This fixes the issue for this particular case (not sure if similar issue exist for other type of detection).
Comments: Easiest way would be: ``` ctx->m_needChunked = boost::iequals(boost::trim_copy(value), U("chunked")); ``` downside to this is that it requires the string to be copied, whereas a custom comparison could just ignore the trailing and leading spaces (i suppose icontains could be used instead of iequals, but that would match such strings as "not-chunked", which isn't valid, but you get the idea).

Viewing all articles
Browse latest Browse all 4845


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