fixed: method Client::PrepareToNewRequest() should not set close_connection flag to false
git-svn-id: svn://ttmath.org/publicrep/libscorpiohttpserver/trunk@1058 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -80,9 +80,10 @@ void Client::PrepareToNewRequest()
|
||||
http_version = http_version_unsupported;
|
||||
answer_generated = false;
|
||||
output_buffer_sent = 0;
|
||||
close_connection = false;
|
||||
|
||||
http_method_str.clear();
|
||||
output_buffer.clear();
|
||||
url.clear();
|
||||
|
||||
// don't set flag close_connection to false here
|
||||
}
|
||||
|
@@ -63,9 +63,20 @@ bool HeadersParser::IsHeadersEnding(const char * ptr)
|
||||
|
||||
bool HeadersParser::ParseFirstHeader(Client & client)
|
||||
{
|
||||
return ParseFirstHeaderMethodName(client) &&
|
||||
ParseFirstHeaderURL(client) &&
|
||||
ParseFirstHeaderHTTPVersion(client);
|
||||
bool first_ok = ParseFirstHeaderMethodName(client) &&
|
||||
ParseFirstHeaderURL(client) &&
|
||||
ParseFirstHeaderHTTPVersion(client);
|
||||
|
||||
SkipWhite(client);
|
||||
|
||||
if( header_index + 1 < client.input_buffer.size() &&
|
||||
client.input_buffer[header_index] == '\r' &&
|
||||
client.input_buffer[header_index+1] == '\n' )
|
||||
{
|
||||
header_index += 2;
|
||||
}
|
||||
|
||||
return first_ok;
|
||||
}
|
||||
|
||||
|
||||
@@ -181,31 +192,6 @@ bool HeadersParser::ParseFirstHeaderHTTPVersion(Client & client)
|
||||
int d1 = client.input_buffer[header_index + 5] - '0';
|
||||
int d2 = client.input_buffer[header_index + 7] - '0';
|
||||
|
||||
int ddd1 = client.input_buffer[header_index + 5] - '0';
|
||||
int ddd2 = client.input_buffer[header_index + 7] - '0';
|
||||
|
||||
if( d1 == 1 )
|
||||
{
|
||||
client.http_version = http_version_1_0;
|
||||
|
||||
}
|
||||
|
||||
if( d2 == 1 )
|
||||
{
|
||||
client.http_version = http_version_1_1;
|
||||
}
|
||||
|
||||
if( ddd1 == 1 )
|
||||
{
|
||||
client.http_version = http_version_1_0;
|
||||
|
||||
}
|
||||
|
||||
if( ddd2 == 1 )
|
||||
{
|
||||
client.http_version = http_version_1_1;
|
||||
}
|
||||
|
||||
if( d1 == 1 )
|
||||
{
|
||||
if( d2 == 0 )
|
||||
|
@@ -193,6 +193,7 @@ int client_socket;
|
||||
Client c;
|
||||
|
||||
c.socket = client_socket;
|
||||
c.close_connection = false;
|
||||
|
||||
client_tab.push_back(c);
|
||||
client_tab.back().PrepareToNewRequest();
|
||||
|
Reference in New Issue
Block a user