| 1234567891011121314151617181920212223242526 |
- #include "HttpParser.h"
- #include "Http1Parser.h"
- #include "Http2Parser.h"
- #include "hlog.h"
- HttpParser* HttpParser::New(http_session_type type, http_version version) {
- HttpParser* hp = NULL;
- if (version == HTTP_V1) {
- hp = new Http1Parser(type);
- }
- else if (version == HTTP_V2) {
- #ifdef WITH_NGHTTP2
- hp = new Http2Parser(type);
- #else
- hlogi("Please recompile WITH_NGHTTP2!\n");
- #endif
- }
- if (hp) {
- hp->version = version;
- hp->type = type;
- }
- return hp;
- }
|