From 50f7050ea944e010dc7d0e01419e10193d7a4319 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Tue, 25 Sep 2018 10:19:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 ++ src/Http/HttpCookie.cpp | 35 ++++++++++++++++++++++++++++++++--- src/Http/HttpCookie.h | 35 ++++++++++++++++++++++++++++++++--- src/Http/HttpSession.h | 2 +- 4 files changed, 67 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 5b9b8efb..8b2be624 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,8 @@ - 客户端提供`文件下载器(支持断点续传)`,`接口请求器`,`文件上传器`。 - 完整HTTP API服务器,可以作为web后台开发框架。 - 支持跨域访问。 + - 客户端支持cookie + - 支持WebSocket服务器 - 其他 - 支持输入YUV+PCM自动生成RTSP/RTMP/HLS/MP4. diff --git a/src/Http/HttpCookie.cpp b/src/Http/HttpCookie.cpp index df4789ed..0b2636ca 100644 --- a/src/Http/HttpCookie.cpp +++ b/src/Http/HttpCookie.cpp @@ -1,11 +1,36 @@ -// -// Created by xzl on 2018/9/23. -// +/* + * MIT License + * + * Copyright (c) 2016 xiongziliang <771730766@qq.com> + * + * This file is part of ZLMediaKit(https://github.com/xiongziliang/ZLMediaKit). + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "HttpCookie.h" #include "Util/util.h" using namespace ZL::Util; +namespace ZL { +namespace Http { + void HttpCookie::setPath(const string &path){ _path = path; } @@ -77,3 +102,7 @@ vector HttpCookieStorage::get(const string &host, const string lam(path); return ret; } + + +} /* namespace Http */ +} /* namespace ZL */ diff --git a/src/Http/HttpCookie.h b/src/Http/HttpCookie.h index a0f6b4e2..2037c79e 100644 --- a/src/Http/HttpCookie.h +++ b/src/Http/HttpCookie.h @@ -1,6 +1,28 @@ -// -// Created by xzl on 2018/9/23. -// +/* + * MIT License + * + * Copyright (c) 2016 xiongziliang <771730766@qq.com> + * + * This file is part of ZLMediaKit(https://github.com/xiongziliang/ZLMediaKit). + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef ZLMEDIAKIT_HTTPCOOKIE_H #define ZLMEDIAKIT_HTTPCOOKIE_H @@ -12,6 +34,9 @@ #include using namespace std; +namespace ZL { +namespace Http { + class HttpCookie { public: typedef std::shared_ptr Ptr; @@ -49,4 +74,8 @@ private: mutex _mtx_cookie; }; + +} /* namespace Http */ +} /* namespace ZL */ + #endif //ZLMEDIAKIT_HTTPCOOKIE_H diff --git a/src/Http/HttpSession.h b/src/Http/HttpSession.h index 806e06f3..1ff32946 100644 --- a/src/Http/HttpSession.h +++ b/src/Http/HttpSession.h @@ -144,7 +144,7 @@ protected: bool mask_flag = _mask_flag; _mask_flag = false; WebSocketSplitter::encode((uint8_t *)ptr,len); - _mask_flag = true; + _mask_flag = mask_flag; };