mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
refine http code, define CRLF consts for http
This commit is contained in:
parent
6913efe127
commit
41f5217360
3 changed files with 30 additions and 9 deletions
|
@ -26,6 +26,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#ifdef SRS_HTTP_CALLBACK
|
||||
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <sys/socket.h>
|
||||
|
@ -37,6 +38,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include <srs_kernel_log.hpp>
|
||||
#include <srs_app_socket.hpp>
|
||||
|
||||
using namespace srs;
|
||||
|
||||
#define SRS_DEFAULT_HTTP_PORT 80
|
||||
#define SRS_HTTP_RESPONSE_OK "0"
|
||||
|
||||
|
@ -150,13 +153,13 @@ int SrsHttpClient::post(SrsHttpUri* uri, std::string req, std::string& res)
|
|||
// POST %s HTTP/1.1\r\nHost: %s\r\nContent-Length: %d\r\n\r\n%s
|
||||
std::stringstream ss;
|
||||
ss << "POST " << uri->get_path() << " "
|
||||
<< "HTTP/1.1\r\n"
|
||||
<< "Host: " << uri->get_host() << "\r\n"
|
||||
<< "Connection: Keep-Alive" << "\r\n"
|
||||
<< "Content-Length: " << std::dec << req.length() << "\r\n"
|
||||
<< "User-Agent: " << RTMP_SIG_SRS_NAME << RTMP_SIG_SRS_VERSION << "\r\n"
|
||||
<< "Content-Type: text/html" << "\r\n"
|
||||
<< "\r\n"
|
||||
<< "HTTP/1.1" << CRLF
|
||||
<< "Host: " << uri->get_host() << CRLF
|
||||
<< "Connection: Keep-Alive" << CRLF
|
||||
<< "Content-Length: " << std::dec << req.length() << CRLF
|
||||
<< "User-Agent: " << RTMP_SIG_SRS_NAME << RTMP_SIG_SRS_VERSION << CRLF
|
||||
<< "Content-Type: text/html" << CRLF
|
||||
<< CRLF
|
||||
<< req;
|
||||
|
||||
SrsSocket skt(stfd);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue