Created
September 9, 2022 03:13
-
-
Save itrobotics/61445305d19c50c2e77d7c9dc66dff7f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#include <stdio.h> | |
#include <string.h> | |
int main () | |
{ | |
char method_str[]="GET /doc/test.html HTTP/1.1 \r\n"; | |
char *url; | |
char *protocol; | |
char *end; | |
url=strpbrk(method_str," \t\n\r") ; | |
printf("%s\n",url); | |
*url++='\0'; | |
url += strspn(url, " \t\n\r"); | |
protocol = strpbrk(url, " \t\n\r"); | |
*protocol++='\0'; | |
protocol += strspn(protocol, " \t\n\r"); | |
end = strpbrk(protocol, " \t\n\r"); | |
*end++='\0'; | |
printf("%s\n",method_str); | |
printf("%s\n",url); | |
printf("%s\n",protocol); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment