-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(additional headers): Adding additional http headers to request a…
…nd response closes #23
- Loading branch information
1 parent
8756a51
commit f4e2c70
Showing
9 changed files
with
207 additions
and
78 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ | |
"src/http.c", | ||
"src/cJSON.c", | ||
"src/http_link.c", | ||
"src/common.c", | ||
"src/bproxy.c" | ||
] | ||
}] | ||
|
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,8 @@ | ||
#ifndef COMMON_H | ||
#define COMMON_H | ||
|
||
#include "string.h" | ||
|
||
char *strnstr(char *s, size_t n, char *find); | ||
|
||
#endif |
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
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
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
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,31 @@ | ||
#include "common.h" | ||
|
||
/* | ||
* n represents size of string s. size of find is determinate by strlen | ||
*/ | ||
char *strnstr(char *s, size_t n, char *find) | ||
{ | ||
size_t find_len = strlen(find); | ||
if (find_len == 0) | ||
{ | ||
return s; | ||
} | ||
if (n < find_len) | ||
{ | ||
return NULL; | ||
} | ||
char *s_end = &s[n - find_len + 1]; | ||
while (1) | ||
{ | ||
while ((*s) != (*find) && s != s_end) | ||
++s; | ||
if (s == s_end) | ||
{ | ||
return NULL; | ||
} | ||
if (strncmp(s++, find, find_len) == 0) | ||
{ | ||
return --s; | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.