Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
nirmalathasa_comp30023_2019_project-1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Abhisha Nirmalathas
nirmalathasa_comp30023_2019_project-1
Commits
eee8e8b6
Commit
eee8e8b6
authored
Apr 14, 2019
by
Abhisha Nirmalathas
Browse files
Options
Downloads
Patches
Plain Diff
checking multiple clients
parent
e35f67f1
No related branches found
No related tags found
No related merge requests found
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
http-server.c
+14
-7
14 additions, 7 deletions
http-server.c
http-server.o
+0
-0
0 additions, 0 deletions
http-server.o
image_tagger
+0
-0
0 additions, 0 deletions
image_tagger
user.c
+2
-1
2 additions, 1 deletion
user.c
user.h
+2
-1
2 additions, 1 deletion
user.h
user.o
+0
-0
0 additions, 0 deletions
user.o
with
18 additions
and
9 deletions
http-server.c
+
14
−
7
View file @
eee8e8b6
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
#include
<stdio.h>
#include
<stdio.h>
#include
<stdlib.h>
#include
<stdlib.h>
#include
<string.h>
#include
<string.h>
#include
<assert.h>
#include
<arpa/inet.h>
#include
<arpa/inet.h>
#include
<fcntl.h>
#include
<fcntl.h>
...
@@ -215,13 +216,13 @@ static bool handle_http_request(int sockfd, User_list* users)
...
@@ -215,13 +216,13 @@ static bool handle_http_request(int sockfd, User_list* users)
}
}
else
if
(
req
->
method
==
GET
)
else
if
(
req
->
method
==
GET
)
{
{
printf
(
"matches a / url but url isize is %zu
\n\n
"
,
strlen
(
req
->
url
));
//
printf("matches a / url but url isize is %zu\n\n", strlen(req->url));
Response
*
resp
=
initialise_session
(
req
);
//
Response* resp = initialise_session(req);
char
*
resp_string
=
parse_response
(
resp
);
//
char* resp_string = parse_response(resp);
printf
(
"COOKIE CREATING RESP %s
\n
"
,
resp_string
);
//
printf("COOKIE CREATING RESP %s\n", resp_string);
// player_session(buff, sockfd, "1_welcome.html", resp_string);
// player_session(buff, sockfd, "1_welcome.html", resp_string);
free
(
resp_string
);
//
free(resp_string);
free
(
resp
);
//
free(resp);
get_request
(
buff
,
sockfd
,
"1_welcome.html"
);
get_request
(
buff
,
sockfd
,
"1_welcome.html"
);
}
}
else
else
...
@@ -270,7 +271,13 @@ int main(int argc, char * argv[])
...
@@ -270,7 +271,13 @@ int main(int argc, char * argv[])
// if ip parameter is not specified
// if ip parameter is not specified
serv_addr
.
sin_addr
.
s_addr
=
inet_addr
(
argv
[
1
]);
serv_addr
.
sin_addr
.
s_addr
=
inet_addr
(
argv
[
1
]);
serv_addr
.
sin_port
=
htons
(
atoi
(
argv
[
2
]));
serv_addr
.
sin_port
=
htons
(
atoi
(
argv
[
2
]));
char
*
user_id
=
malloc
(
sizeof
(
char
)
*
(
strlen
(
argv
[
1
])
+
strlen
(
argv
[
2
])));
user_id
[
0
]
=
'\0'
;
strcat
(
user_id
,
argv
[
1
]);
strcat
(
user_id
,
argv
[
2
]);
printf
(
"%s
\n\n\\
n"
,
user_id
);
assert
(
user_id
);
free
(
user_id
);
// bind address to socket
// bind address to socket
if
(
bind
(
sockfd
,
(
struct
sockaddr
*
)
&
serv_addr
,
sizeof
(
serv_addr
))
<
0
)
if
(
bind
(
sockfd
,
(
struct
sockaddr
*
)
&
serv_addr
,
sizeof
(
serv_addr
))
<
0
)
{
{
...
...
This diff is collapsed.
Click to expand it.
http-server.o
+
0
−
0
View file @
eee8e8b6
No preview for this file type
This diff is collapsed.
Click to expand it.
image_tagger
+
0
−
0
View file @
eee8e8b6
No preview for this file type
This diff is collapsed.
Click to expand it.
user.c
+
2
−
1
View file @
eee8e8b6
...
@@ -6,9 +6,10 @@
...
@@ -6,9 +6,10 @@
#include
"user.h"
#include
"user.h"
User
*
new_user
(){
User
*
new_user
(
char
*
id
){
User
*
user
=
malloc
(
sizeof
(
User
*
));
User
*
user
=
malloc
(
sizeof
(
User
*
));
assert
(
user
);
assert
(
user
);
user
->
id
=
id
;
user
->
n_capacity
=
5
;
user
->
n_capacity
=
5
;
user
->
n_keywords
=
0
;
user
->
n_keywords
=
0
;
user
->
status
=
WAIT
;
user
->
status
=
WAIT
;
...
...
This diff is collapsed.
Click to expand it.
user.h
+
2
−
1
View file @
eee8e8b6
...
@@ -8,6 +8,7 @@ typedef enum
...
@@ -8,6 +8,7 @@ typedef enum
typedef
struct
User
{
typedef
struct
User
{
char
*
name
;
char
*
name
;
char
*
id
;
char
**
keywords
;
char
**
keywords
;
int
n_keywords
;
int
n_keywords
;
STATUS
status
;
STATUS
status
;
...
@@ -19,7 +20,7 @@ typedef struct User_list{
...
@@ -19,7 +20,7 @@ typedef struct User_list{
User
**
users
;
User
**
users
;
}
User_list
;
}
User_list
;
User
*
new_user
();
User
*
new_user
(
char
*
id
);
User_list
*
initialise_player_list
();
User_list
*
initialise_player_list
();
...
...
This diff is collapsed.
Click to expand it.
user.o
+
0
−
0
View file @
eee8e8b6
No preview for this file type
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment