Even more documentation, RTMP Connector compiles again, but still extremely buggy. Will create RTMP debugging tool soon. Something wrong with RTMP Connector reading FLV::Tags... needs more investigation.

This commit is contained in:
Thulinma 2011-04-11 17:05:36 +02:00
parent b592442d6b
commit 6db6829545
29 changed files with 1451 additions and 1437 deletions

View file

@ -1,3 +1,6 @@
/// \file http_parser.h
/// Holds all headers for the HTTP namespace.
#pragma once
#include <map>
#include <string>
@ -5,37 +8,40 @@
#include <stdio.h>
#include "ddv_socket.h"
class HTTPReader{
public:
HTTPReader();
bool Read(DDV::Socket & sock);
bool Read(FILE * F);
std::string GetHeader(std::string i);
std::string GetVar(std::string i);
void SetHeader(std::string i, std::string v);
void SetHeader(std::string i, int v);
void SetVar(std::string i, std::string v);
void SetBody(std::string s);
void SetBody(char * buffer, int len);
std::string BuildRequest();
std::string BuildResponse(std::string code, std::string message);
void SendResponse(DDV::Socket & conn, std::string code, std::string message);
void SendBodyPart(DDV::Socket & conn, char * buffer, int len);
void SendBodyPart(DDV::Socket & conn, std::string bodypart);
void Clean();
bool CleanForNext();
std::string body;
std::string method;
std::string url;
std::string protocol;
unsigned int length;
private:
bool seenHeaders;
bool seenReq;
bool parse();
std::string HTTPbuffer;
std::map<std::string, std::string> headers;
std::map<std::string, std::string> vars;
void Trim(std::string & s);
};//HTTPReader
/// Holds all HTTP processing related code.
namespace HTTP{
/// Simple class for reading and writing HTTP 1.0 and 1.1.
class Parser{
public:
Parser();
bool Read(DDV::Socket & sock);
bool Read(FILE * F);
std::string GetHeader(std::string i);
std::string GetVar(std::string i);
void SetHeader(std::string i, std::string v);
void SetHeader(std::string i, int v);
void SetVar(std::string i, std::string v);
void SetBody(std::string s);
void SetBody(char * buffer, int len);
std::string BuildRequest();
std::string BuildResponse(std::string code, std::string message);
void SendResponse(DDV::Socket & conn, std::string code, std::string message);
void SendBodyPart(DDV::Socket & conn, char * buffer, int len);
void SendBodyPart(DDV::Socket & conn, std::string bodypart);
void Clean();
bool CleanForNext();
std::string body;
std::string method;
std::string url;
std::string protocol;
unsigned int length;
private:
bool seenHeaders;
bool seenReq;
bool parse();
std::string HTTPbuffer;
std::map<std::string, std::string> headers;
std::map<std::string, std::string> vars;
void Trim(std::string & s);
};//HTTP::Parser class
};//HTTP namespace