Added urltest testing binary
This commit is contained in:
parent
9cc2f75a8e
commit
e772168a91
2 changed files with 28 additions and 0 deletions
24
test/url.cpp
Normal file
24
test/url.cpp
Normal file
|
@ -0,0 +1,24 @@
|
|||
#include "../lib/http_parser.cpp"
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char ** argv){
|
||||
if (argc < 2){
|
||||
std::cout << "Usage: " << argv[0] << " URL" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
HTTP::URL u(argv[1]);
|
||||
for (int i = 1; i < argc; ++i){
|
||||
if (i > 1){
|
||||
u = u.link(argv[i]);
|
||||
}
|
||||
std::cout << argv[i] << " -> " << u.getUrl() << std::endl;
|
||||
std::cout << "Protocol: " << u.protocol << std::endl;
|
||||
std::cout << "Host: " << u.host << std::endl;
|
||||
std::cout << "Port: " << u.getPort() << std::endl;
|
||||
std::cout << "Path: " << u.path << std::endl;
|
||||
std::cout << "Query: " << u.args << std::endl;
|
||||
std::cout << "Fragment: " << u.frag << std::endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue