ithewei 3 роки тому
батько
коміт
39ba27f677
2 змінених файлів з 5 додано та 3 видалено
  1. 1 1
      http/Http1Parser.h
  2. 4 2
      http/HttpMessage.cpp

+ 1 - 1
http/Http1Parser.h

@@ -22,7 +22,7 @@ public:
     virtual ~Http1Parser();
 
     void handle_header() {
-        if (header_field.size() != 0 && header_value.size() != 0) {
+        if (header_field.size() != 0) {
             if (stricmp(header_field.c_str(), "Set-CooKie") == 0 ||
                 stricmp(header_field.c_str(), "Cookie") == 0) {
                 HttpCookie cookie;

+ 4 - 2
http/HttpMessage.cpp

@@ -66,7 +66,7 @@ bool HttpCookie::parse(const std::string& str) {
 }
 
 std::string HttpCookie::dump() const {
-    assert(!name.empty() && !value.empty());
+    assert(!name.empty());
     std::string res;
     res = name;
     res += "=";
@@ -500,7 +500,9 @@ std::string HttpMessage::Dump(bool is_dump_headers, bool is_dump_body) {
 
 void HttpRequest::DumpUrl() {
     std::string str;
-    if (url.size() != 0 && strstr(url.c_str(), "://") != NULL) {
+    if (url.size() != 0 &&
+        *url.c_str() != '/' &&
+        strstr(url.c_str(), "://") != NULL) {
         // have been complete url
         goto query;
     }