Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 303339
Collapse All | Expand All

(-)a/libpbe/include/HttpResponse.hh (-1 / +2 lines)
Lines 33-39 class HttpResponse { Link Here
33
33
34
public:
34
public:
35
  HttpResponse():
35
  HttpResponse():
36
    http_version("HTTP/1.1"), status_code(200), reason_phrase("OK") {}
36
    http_version("HTTP/1.1"), status_code(200), reason_phrase("OK"), dont_chunk(false) {}
37
37
38
  HttpResponse(std::string s);
38
  HttpResponse(std::string s);
39
39
Lines 44-49 public: Link Here
44
  std::string reason_phrase;
44
  std::string reason_phrase;
45
  std::map<std::string,std::string> headers;
45
  std::map<std::string,std::string> headers;
46
  std::string body;
46
  std::string body;
47
  bool dont_chunk;
47
};
48
};
48
49
49
50
(-)a/libpbe/src/HttpDaemon.cc (+1 lines)
Lines 55-60 void HttpDaemon::session(FileDescriptor& Link Here
55
	  // We should send a 1.0 response if the request was for 1.0; i.e.
55
	  // We should send a 1.0 response if the request was for 1.0; i.e.
56
          // we should send a content-length header and not use chunked encoding.
56
          // we should send a content-length header and not use chunked encoding.
57
	  close_connection=true;
57
	  close_connection=true;
58
	  resp.dont_chunk=true;
58
	}
59
	}
59
	if (req.headers["Connection"]=="close") {  
60
	if (req.headers["Connection"]=="close") {  
60
	  // could be other tokens in the line.  Should be case-insensitive.
61
	  // could be other tokens in the line.  Should be case-insensitive.
(-)a/libpbe/src/HttpResponse.cc (-6 / +11 lines)
Lines 50-63 void HttpResponse::send(FileDescriptor& Link Here
50
       i != headers.end(); ++i) {
50
       i != headers.end(); ++i) {
51
    s << i->first << ": " << i->second << "\r\n";
51
    s << i->first << ": " << i->second << "\r\n";
52
  }
52
  }
53
  s << "Transfer-Encoding: chunked\r\n"
53
  if (dont_chunk) {
54
    << "\r\n";
54
    s << "Content-Length: " << body.length() << "\r\n"
55
  if (body.length()==0) {
55
      << "\r\n"
56
    s << "0\r\n\r\n";
56
      << body;
57
  } else {
57
  } else {
58
    send_chunked(s,body);
58
    s << "Transfer-Encoding: chunked\r\n"
59
      << "\r\n";
60
    if (body.length()==0) {
61
      s << "0\r\n\r\n";
62
    } else {
63
      send_chunked(s,body);
64
    }
59
  }
65
  }
60
61
  fd.writeall(s.str());
66
  fd.writeall(s.str());
62
}
67
}
63
68

Return to bug 303339