HttpSession.cpp 426 B

12345678910111213141516171819
  1. #include "HttpSession.h"
  2. #include "Http1Session.h"
  3. #include "Http2Session.h"
  4. HttpSession* HttpSession::New(http_session_type type, http_version version) {
  5. if (version == HTTP_V1) {
  6. return new Http1Session(type);
  7. }
  8. else if (version == HTTP_V2) {
  9. #ifdef WITH_NGHTTP2
  10. return new Http2Session(type);
  11. #else
  12. fprintf(stderr, "Please recompile WITH_NGHTTP2!\n");
  13. #endif
  14. }
  15. return NULL;
  16. }