diff --git a/.gitignore b/.gitignore index 887da0d0..23328068 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *.d out_folder CWebStudio_test.h +*.pyc # Object files *.o *.ko diff --git a/.idea/editor.xml b/.idea/editor.xml new file mode 100644 index 00000000..855412d8 --- /dev/null +++ b/.idea/editor.xml @@ -0,0 +1,103 @@ + + + + + \ No newline at end of file diff --git a/CWebStudio.h b/CWebStudio.h index d32164d7..2c9a2b4b 100644 --- a/CWebStudio.h +++ b/CWebStudio.h @@ -5639,7 +5639,6 @@ char* cweb_replace_string(const char *target, const char *old_element, const cha unsigned char *cweb_load_any_content(const char * path,int *size,bool *is_binary){ FILE *file = fopen(path,"rb"); if(file == NULL){ - free(file); return NULL; } fseek(file,0,SEEK_END); diff --git a/src/extras/extras.c b/src/extras/extras.c index cbee4269..6312f407 100644 --- a/src/extras/extras.c +++ b/src/extras/extras.c @@ -5,7 +5,6 @@ unsigned char *cweb_load_any_content(const char * path,int *size,bool *is_binary){ FILE *file = fopen(path,"rb"); if(file == NULL){ - free(file); return NULL; } fseek(file,0,SEEK_END); diff --git a/teste.c b/teste.c new file mode 100644 index 00000000..d66bc16c --- /dev/null +++ b/teste.c @@ -0,0 +1,15 @@ +#include "CWebStudio.h" +CwebNamespace cweb; + +struct CwebHttpResponse *main_sever(struct CwebHttpRequest *request ){ + + const char *html = "

Hello World

"; + return cweb.response.send_any("text/html",strlen(html),(unsigned char*)html,200); +} + +int main(int argc, char *argv[]){ + cweb = newCwebNamespace(); + CwebServer server = newCwebSever(5000, main_sever); + cweb.server.start(&server); + return 0; +} \ No newline at end of file