Skip to content

Commit

Permalink
Wrong content type does nonetheless need to call back (with an error …
Browse files Browse the repository at this point in the history
…in this case).
  • Loading branch information
John-LittleBearLabs committed Jan 12, 2024
1 parent d8ff4f8 commit 1fd7e63
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/tour.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function url_case() {
if [ ! -f "_${1}_${n}" ]
then
echo "Failed to produce expected file _${1}_${n} for test case " "${@}"
ls -lrth _ip?s_*
ls -lrth
exit 7
elif cat "_${1}_${n}" | md5sum | cut -d ' ' -f 1 > actual
then
Expand Down
20 changes: 11 additions & 9 deletions library/src/ipfs_client/test_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -332,19 +332,21 @@ class HttpSession : public std::enable_shared_from_this<HttpSession> {
return;
}
auto content_type = (*res_)[http::field::content_type];
auto me = shared_from_this();
auto respond = [me, get_hdr]() {
auto& r = *(me->res_);
me->cb_(r.result_int(), r.body(), get_hdr);
};
if (content_type.empty() ||
boost::algorithm::icontains(content_type, desc_.accept)) {
auto me = shared_from_this();
auto respond = [me, get_hdr]() {
auto& r = *(me->res_);
me->cb_(r.result_int(), r.body(), get_hdr);
};
boost::asio::defer(strand_, respond);
LOG(TRACE) << "Got " << content_type;
} else {
GOOGLE_LOG(INFO) << desc_.url
<< " response incorrect content type: " << content_type
<< " != " << desc_.accept;
LOG(INFO) << desc_.url
<< " response incorrect content type: " << content_type
<< " != " << desc_.accept;
res_->result(501);
}
boost::asio::defer(strand_, respond);
close();
}
int redirect_count(std::string_view comp) {
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 1fd7e63

Please sign in to comment.