mirror of
https://gitee.com/TarsCloud/TarsCpp.git
synced 2024-12-22 22:16:38 +08:00
nghttp2 succ
This commit is contained in:
parent
7b8c53e2ee
commit
642c9228d7
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
#ifndef _Http2Imp_H_
|
||||
#define _HttpImp_H_
|
||||
#define _Http2Imp_H_
|
||||
|
||||
#include "servant/Application.h"
|
||||
#include "util/tc_spin_lock.h"
|
||||
|
@ -36,7 +36,7 @@ TC_NetWorkBuffer::PACKET_TYPE parseHttp2(TC_NetWorkBuffer&in, vector<char> &out)
|
||||
Http2Imp::addHttp2Session(connection->getId(), session);
|
||||
}
|
||||
|
||||
cout << "parseHttp2:" << in.getBufferLength() << endl;
|
||||
cout << "parseHttp2:" << in.getBufferLength() << ", " << session << endl;
|
||||
|
||||
return session->parse(in, out);
|
||||
}
|
||||
|
@ -251,10 +251,7 @@ vector<char> ProxyProtocol::http2Request(RequestPacket& request, Transceiver *tr
|
||||
if (!request.sServantName.empty())
|
||||
nva.push_back(nv2);
|
||||
|
||||
for (std::map<std::string, std::string>::const_iterator
|
||||
it(request.context.begin());
|
||||
it != request.context.end();
|
||||
++ it)
|
||||
for (std::map<std::string, std::string>::const_iterator it(request.context.begin()); it != request.context.end(); ++ it)
|
||||
{
|
||||
nghttp2_nv nv = MAKE_STRING_NV(it->first, it->second);
|
||||
nva.push_back(nv);
|
||||
@ -292,6 +289,7 @@ vector<char> ProxyProtocol::http2Request(RequestPacket& request, Transceiver *tr
|
||||
vector<char> out;
|
||||
|
||||
out.assign(session->sendBuffer().begin(), session->sendBuffer().end());
|
||||
session->sendBuffer().clear();
|
||||
|
||||
cout << "iRequestId:" << request.iRequestId << ", size:" << out.size() << endl;
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 2e3c1abd10ad801f74f7673f54f7d45b7962318f
|
||||
Subproject commit 7c22d46777d76c8c08c2161f7cb4d9f0f45991d7
|
@ -58,7 +58,7 @@ static int on_header_callback(nghttp2_session *session,
|
||||
size_t namelen, const uint8_t *value,
|
||||
size_t valuelen, uint8_t flags, void *user_data)
|
||||
{
|
||||
//TLOGDEBUG("[on_header_callback] streamid:" << frame->hd.stream_id << " name:" << name << " value:" << value << " flags:" << flags << endl);
|
||||
cout << "[on_header_callback] streamid:" << frame->hd.stream_id << " name:" << name << " value:" << value << " flags:" << flags << endl;
|
||||
|
||||
TC_Http2Session *ptr = (TC_Http2Session*)user_data;
|
||||
{
|
||||
@ -100,11 +100,10 @@ static int on_begin_headers_callback(nghttp2_session *session,
|
||||
const nghttp2_frame *frame,
|
||||
void *user_data)
|
||||
{
|
||||
//TLOGDEBUG("[on_begin_headers_callback] streamid:" << frame->hd.stream_id << endl);
|
||||
cout << "[on_begin_headers_callback] streamid:" << frame->hd.stream_id << endl;
|
||||
TC_Http2Session *ptr = (TC_Http2Session*)user_data;
|
||||
|
||||
if (frame->hd.type != NGHTTP2_HEADERS ||
|
||||
frame->headers.cat != NGHTTP2_HCAT_REQUEST) {
|
||||
if (frame->hd.type != NGHTTP2_HEADERS || frame->headers.cat != NGHTTP2_HCAT_REQUEST) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -130,7 +129,7 @@ static int on_frame_recv_callback(nghttp2_session *session, const nghttp2_frame
|
||||
/* Check that the client request has finished */
|
||||
if (frame->hd.flags & NGHTTP2_FLAG_END_STREAM)
|
||||
{
|
||||
//TLOGDEBUG("[on_frame_recv_callback] NGHTTP2_FLAG_END_STREAM" << endl);
|
||||
cout << "[on_frame_recv_callback] NGHTTP2_FLAG_END_STREAM" << endl;
|
||||
|
||||
{
|
||||
TC_LockT<TC_SpinLock> lock(ptr->reqLock_);
|
||||
@ -162,7 +161,8 @@ static int on_data_chunk_recv_callback(nghttp2_session *session, uint8_t flags,
|
||||
int32_t stream_id, const uint8_t *data,
|
||||
size_t len, void *user_data)
|
||||
{
|
||||
//TLOGDEBUG("[on_data_chunk_recv_callback] stream_id:" << stream_id << endl);
|
||||
cout << "[on_data_chunk_recv_callback] stream_id:" << stream_id << endl;
|
||||
|
||||
TC_Http2Session *ptr = (TC_Http2Session*)user_data;
|
||||
{
|
||||
TC_LockT<TC_SpinLock> lock(ptr->reqLock_);
|
||||
@ -177,7 +177,7 @@ static int on_data_chunk_recv_callback(nghttp2_session *session, uint8_t flags,
|
||||
|
||||
static int on_stream_close_callback(nghttp2_session *session, int32_t stream_id, uint32_t error_code, void *user_data)
|
||||
{
|
||||
//TLOGDEBUG("[on_stream_close_callback] streamid:" << stream_id << endl);
|
||||
cout << "[on_stream_close_callback] streamid:" << stream_id << endl;
|
||||
|
||||
TC_Http2Session *ptr = (TC_Http2Session*)user_data;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user