-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Edouard CATTEZ
committed
Feb 9, 2015
1 parent
91b7eba
commit 40a9edc
Showing
5 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
http.o: http.c http.h | ||
main.o: main.c socket.h http.h | ||
socket.o: socket.c socket.h | ||
url.o: url.c url.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include "url.h" | ||
|
||
char * rewrite_url(char * url) | ||
{ | ||
char *rewrited; | ||
int i; | ||
|
||
i = 0; | ||
while (url[i] != '\0' && url[i] != '?') | ||
{ | ||
i++; | ||
} | ||
|
||
rewrited = (char *)malloc(i+1); | ||
strncpy(rewrited, url, i); | ||
rewrited[i+1] = '\0'; | ||
|
||
return rewrited; | ||
} | ||
|
||
int check_and_open(const char * url, const char * document_root) | ||
{ | ||
|
||
return -1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#ifndef __URL_H__ | ||
#define __URL_H__ | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
|
||
/** | ||
Retourne l'url sans la partie Query succédant le caractère ? (inclus) | ||
*/ | ||
char * rewrite_url(char * url); | ||
|
||
/** | ||
La fonction doit s’assurer que le fichier est un fichier régulier, ouvrir le fichier en lecture seule et | ||
retourner un descripteur vers ce fichier à l’aide de la fonction open. La fonction doit retourner -1 | ||
en cas d’erreur et un descripteur valide en cas de succès. | ||
*/ | ||
int check_and_open(const char * url, const char * document_root); | ||
|
||
|
||
#endif |