Blockquote
:) server.c exists
:) server compiles
:) HTTP/1.0 returns error code 505
:) Method of 'abcGET' returns error code 405
:) Method of 'GETabc' returns error code 405
:) request-target without starting '/' returns error code 501
:) request-target of abc/hello.php returns error code 501
:) Requesting cat.exe returns error code 501
:( Requesting non-existant file returns error code 404
\ expected output, not an exit code of 0
:) Requesting request-target with " returns error code 400
:) Two spaces after GET returns error code
:) A space within the request target returns error code
:( Two spaces before HTTP/1.1 returns error code
\ expected output, not an exit code of 0
char* abs_path, char* query) {
// TODO
char A[5];
char B[LimitRequestLine + 1];
char C[LimitRequestLine + 1];
int i=0,j=0;
char* p=strchr(line,' ');
char* n=strrchr(line,' ');
for (i=0;line[i]!=' ';i++)
{
A[i]=line[i];
}
A[i]='\0';
if (strcmp(A,"GET")!=0)
{
error(405);**strong text**
return false;
}
for (i=1,j=0;p[i]!=' ';i++,j++)
{
B[j]=p[i];
}
B[j]='\0';
if (B[0]!='/')
{
error(501);
return false;
}
for (j=0;B[j]!='\0';j++)
{
if (B[j]=='\"')
{
error(400);
return false;
}
}
for (i=1,j=0;n[i]!='\r';i++,j++)
{
C[j]=n[i];
}
C[j]='\0';
if (strcmp(C,"HTTP/1.1")!=0)
{
error(505);
return false;
}
const char* type=lookup(B);
char* exist=strchr(B,'.');
if (exist==NULL)
{
error(404);
}
else if (type==NULL)
{
error(501);
return false;
}
strcpy(abs_path,B);
return true;
}
\ expected output, but not "HTTP/1.1 505 HTTP Version Not Supported..."
)