nghttpx: Send 100-continue for API request
This commit is contained in:
parent
d837887af6
commit
9653ae98a6
|
@ -411,6 +411,23 @@ int htp_hdrs_completecb(http_parser *htp) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
auto faddr = handler->get_upstream_addr();
|
||||
|
||||
if (faddr->api) {
|
||||
// Normally, we forward expect: 100-continue to backend server,
|
||||
// and let them decide whether responds with 100 Continue or not.
|
||||
// For API endpoint, we have no backend, so just send 100 Continue
|
||||
// here to make the client happy.
|
||||
auto expect = req.fs.header(http2::HD_EXPECT);
|
||||
if (expect &&
|
||||
util::strieq(expect->value, StringRef::from_lit("100-continue"))) {
|
||||
auto output = downstream->get_response_buf();
|
||||
constexpr auto res = StringRef::from_lit("HTTP/1.1 100 Continue\r\n\r\n");
|
||||
output->append(res);
|
||||
handler->signal_write();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
} // namespace
|
||||
|
|
Loading…
Reference in New Issue