Skip to content

Stefano - C-Web-Server#309

Open
stefanodem wants to merge 9 commits intobloominstituteoftechnology:masterfrom
stefanodem:master
Open

Stefano - C-Web-Server#309
stefanodem wants to merge 9 commits intobloominstituteoftechnology:masterfrom
stefanodem:master

Conversation

@stefanodem
Copy link
Copy Markdown

No description provided.

Comment thread src/server.c
time_t rawtime;
struct tm *current_time;
time(&rawtime);
current_time = localtime(&rawtime);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pretty much exactly what I have. Well done.

Comment thread src/server.c
body
);

int response_length = strlen(response);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also set int response_length = sprintf(...), which returns the length of the sprintf.

Comment thread src/server.c
srand(time(NULL));
char random_number_string[20];
int random_number = rand() % 20;
sprintf(random_number_string, "%d", random_number);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's smart to print this to a string because of what send_response() accepts.

Comment thread src/server.c

// Read the three components of the first request line

sscanf(request, "%s %s", method, path);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll also want to add an http_version to this sscanf.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback Grant! I'll try to incorporate it today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants