Browse Source

Fixed unproperly initialized reserved fields related to #24

master
Artyom Beilis 6 years ago
parent
commit
1f7f3c4ed1
1 changed files with 14 additions and 11 deletions
  1. +14
    -11
      src/fastcgi_api.cpp

+ 14
- 11
src/fastcgi_api.cpp View File

@@ -50,6 +50,9 @@ namespace cgi {
fastcgi(cppcms::service &srv) :
connection(srv),
socket_(srv.impl().get_io_service()),
header_(),
full_header_(),
eof_(),
eof_callback_(false)
{
reset_all();
@@ -179,9 +182,9 @@ namespace cgi {
full_header_.padding_length = pad_len = 1;
full_header_.to_net();
}
else {
pad_len = 1;
}
else {
pad_len = 1;
}
packet += io::buffer(&full_header_,sizeof(full_header_));
}
else {
@@ -218,12 +221,12 @@ namespace cgi {
prepare_eof();
packet += io::buffer(&eof_,sizeof(eof_));
}
#ifdef DEBUG_FASTCGI
#ifdef DEBUG_FASTCGI
std::pair<booster::aio::const_buffer::entry const *,size_t> cnk = packet.get();
for(size_t i=0;i<cnk.second;i++) {
std::cerr << "[ " << (void const *)(cnk.first[i].ptr) << " " << cnk.first[i].size << "]\n" << std::endl;
}
#endif
for(size_t i=0;i<cnk.second;i++) {
std::cerr << "[ " << (void const *)(cnk.first[i].ptr) << " " << cnk.first[i].size << "]\n" << std::endl;
}
#endif
return packet;
}
virtual booster::aio::stream_socket &socket() { return socket_; }
@@ -301,7 +304,7 @@ namespace cgi {
uint16_t request_id;
uint16_t content_length;
unsigned char padding_length;
unsigned char reserverd;
unsigned char reserved;
void to_host() {
request_id = ntohs(request_id);
content_length = ntohs(content_length);
@@ -381,7 +384,7 @@ namespace cgi {

struct fcgi_unknown_type_body {
unsigned char type;
unsigned char reserverd[7];
unsigned char reserved[7];
};

struct fcgi_unknown_type_record {
@@ -623,7 +626,7 @@ namespace cgi {
async_read_headers(h);
}

// this is internal function for short messages
// this is internal function for short messages
void async_send_respnse(handler const &h)
{
header_.content_length=body_.size();


Loading…
Cancel
Save