Commit f176fe92 authored by zyearn's avatar zyearn Committed by zhujiashun

Fix conflicts after rebase origin/master

parent 9f166e85
......@@ -1629,15 +1629,16 @@ void H2UnsentRequest::Describe(butil::IOBuf* desc) const {
}
}
H2UnsentResponse::H2UnsentResponse(Controller* c, const TrailerMessage& trailers)
H2UnsentResponse::H2UnsentResponse(Controller* c, int stream_id, const TrailerMessage& trailers)
: _size(0)
, _stream_id(c->http_request().h2_stream_id())
, _stream_id(stream_id)
, _http_response(c->release_http_response())
, _trailers(trailers) {
_data.swap(c->response_attachment());
}
H2UnsentResponse* H2UnsentResponse::New(Controller* c, const TrailerMessage& trailers) {
H2UnsentResponse* H2UnsentResponse::New(Controller* c, int stream_id,
const TrailerMessage& trailers) {
const HttpHeader* const h = &c->http_response();
const CommonStrings* const common = get_common_strings();
const bool need_content_length =
......@@ -1648,7 +1649,7 @@ H2UnsentResponse* H2UnsentResponse::New(Controller* c, const TrailerMessage& tra
+ (size_t)need_content_type;
const size_t memsize = offsetof(H2UnsentResponse, _list) +
sizeof(HPacker::Header) * maxsize;
H2UnsentResponse* msg = new (malloc(memsize)) H2UnsentResponse(c, trailers);
H2UnsentResponse* msg = new (malloc(memsize)) H2UnsentResponse(c, stream_id, trailers);
// :status
if (h->status_code() == 200) {
msg->push(common->H2_STATUS, common->STATUS_200);
......
......@@ -194,7 +194,7 @@ private:
class H2UnsentResponse : public SocketMessage {
public:
static H2UnsentResponse* New(Controller* c, const TrailerMessage& trailers);
static H2UnsentResponse* New(Controller* c, int stream_id, const TrailerMessage& trailers);
void Destroy();
void Describe(butil::IOBuf*) const;
// @SocketMessage
......@@ -208,7 +208,7 @@ private:
void push(const std::string& name, const std::string& value)
{ new (&_list[_size++]) HPacker::Header(name, value); }
H2UnsentResponse(Controller* c, const TrailerMessage& trailers);
H2UnsentResponse(Controller* c, int stream_id, const TrailerMessage& trailers);
~H2UnsentResponse() {}
H2UnsentResponse(const H2UnsentResponse&);
void operator=(const H2UnsentResponse&);
......
......@@ -802,7 +802,7 @@ HttpResponseSender::~HttpResponseSender() {
// Set status-code with default value(converted from error code)
// if user did not set it.
if (res_header->status_code() == HTTP_STATUS_OK) {
res_header->set_status_code(ErrorCode2StatusCode(cntl->ErrorCode()));
res_header->set_status_code(ErrorCodeToStatusCode(cntl->ErrorCode()));
}
// Fill ErrorCode into header
res_header->SetHeader(common->ERROR_CODE,
......@@ -907,7 +907,7 @@ HttpResponseSender::~HttpResponseSender() {
wopt.ignore_eovercrowded = true;
if (req_header->is_http2()) {
SocketMessagePtr<H2UnsentResponse> h2_response(
H2UnsentResponse::New(cntl, trailers));
H2UnsentResponse::New(cntl, _h2_stream_id, trailers));
if (h2_response == NULL) {
LOG(ERROR) << "Fail to make http2 response";
errno = EINVAL;
......
......@@ -216,7 +216,8 @@ protected:
butil::IOBufAsZeroCopyOutputStream wrapper(&cntl.response_attachment());
EXPECT_TRUE(res.SerializeToZeroCopyStream(&wrapper));
}
brpc::policy::H2UnsentResponse* h2_res = brpc::policy::H2UnsentResponse::New(&cntl, h2_stream_id);
const brpc::TrailerMessage dummy;
brpc::policy::H2UnsentResponse* h2_res = brpc::policy::H2UnsentResponse::New(&cntl, h2_stream_id, dummy);
butil::Status st = h2_res->AppendAndDestroySelf(out, _h2_client_sock.get());
ASSERT_TRUE(st.ok());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment