Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #63 from developerbmw/pr
Browse files Browse the repository at this point in the history
Fix web server crashing problem
  • Loading branch information
codebox committed Sep 21, 2015
2 parents 181a40d + ad921cc commit 88ba1a3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions webserver/src/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,16 @@ void writeHeadersOk(SOCKET fd, char* contentType, int endHeaders){
}

void writeHeadersSeeOther(SOCKET fd, struct Request* req, int endHeaders){
char *newPath;
struct NameValuePair* param = req->headers;
while (param != NULL){
if (strcmp(param->name, "Host") == 0) {
char* newPath[19 + strlen(param->value)];
sprintf(newPath,"http://%s/index.html", param->value);
writeHeaders(fd, HTTP_SEE_OTHER, newPath, endHeaders);
break;
}
param = param->next;
}
writeHeaders(fd, HTTP_SEE_OTHER, newPath, endHeaders);
}

static void writeHeaders(SOCKET fd, struct HttpResponse response, char* contentType, int endHeaders){
Expand Down

0 comments on commit 88ba1a3

Please sign in to comment.