Hopelijk laatste socket fix

This commit is contained in:
Thulinma 2011-04-18 16:08:55 +02:00
parent 8f3466ea78
commit 9ff67b96fd
2 changed files with 5 additions and 6 deletions

View file

@ -128,12 +128,11 @@ void HTTP::Parser::SetVar(std::string i, std::string v){
} }
/// Attempt to read a whole HTTP request or response from DDV::Socket sock. /// Attempt to read a whole HTTP request or response from DDV::Socket sock.
/// \param sock The socket to use.
/// \param nonblock When true, will not block even if the socket is blocking.
/// \return True of a whole request or response was read, false otherwise. /// \return True of a whole request or response was read, false otherwise.
bool HTTP::Parser::Read(DDV::Socket & sock){ bool HTTP::Parser::Read(DDV::Socket & sock, bool nonblock){
//returned true als hele http packet gelezen is if (nonblock && (sock.ready() < 1)){return parse();}
int r = 0;
int b = 0;
char buffer[500];
sock.read(HTTPbuffer); sock.read(HTTPbuffer);
return parse(); return parse();
}//HTTPReader::ReadSocket }//HTTPReader::ReadSocket

View file

@ -14,7 +14,7 @@ namespace HTTP{
class Parser{ class Parser{
public: public:
Parser(); Parser();
bool Read(DDV::Socket & sock); bool Read(DDV::Socket & sock, bool nonblock = true);
bool Read(FILE * F); bool Read(FILE * F);
std::string GetHeader(std::string i); std::string GetHeader(std::string i);
std::string GetVar(std::string i); std::string GetVar(std::string i);