Skip to content

Commit

Permalink
hotplace rev.447 http
Browse files Browse the repository at this point in the history
  • Loading branch information
princeb612 committed Jan 4, 2024
1 parent 34bfc79 commit 0e89cf5
Show file tree
Hide file tree
Showing 23 changed files with 937 additions and 643 deletions.
6 changes: 3 additions & 3 deletions sdk/crypto/authenticode/authenticode_verifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -906,8 +906,8 @@ static return_t get_crl(authenticode_context_t* context, X509* cert, authenticod
url_info_t url_info;

split_url(crl_url.c_str(), &url_info);
std::string crl_path = format("%s/%s/%s", context_crl_path.c_str(), url_info.domainip.c_str(), url_info.uripath.c_str());
std::string crl_file = format("%s/%s%s", context_crl_path.c_str(), url_info.domainip.c_str(), url_info.uri.c_str());
std::string crl_path = format("%s/%s/%s", context_crl_path.c_str(), url_info.host.c_str(), url_info.uripath.c_str());
std::string crl_file = format("%s/%s%s", context_crl_path.c_str(), url_info.host.c_str(), url_info.uri.c_str());

//__vtrace(0, "CRL : %s", crl_url.c_str());

Expand All @@ -933,7 +933,7 @@ static return_t get_crl(authenticode_context_t* context, X509* cert, authenticod
url_info_t url;
split_url (context->proxy_url.c_str (), &url);
cmdline_proxy += format ("-e http_proxy=%s://%s@%s:%d/ ",
url.protocol.c_str (), context->proxy_user.c_str (), url.domainip.c_str (), url.port);
url.protocol.c_str (), context->proxy_user.c_str (), url.host.c_str (), url.port);
}
}

Expand Down
15 changes: 11 additions & 4 deletions sdk/io/string/split.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ return_t split_url(const char* url, url_info_t* info) {
}

info->protocol.clear();
info->domainip.clear();
info->host.clear();
info->port = 0;
info->uri.clear();
info->uripath.clear();
Expand All @@ -44,7 +44,7 @@ return_t split_url(const char* url, url_info_t* info) {

pos_uri = input.find_first_of("/", pos_protocol + 3);
if (std::string::npos == pos_uri) {
info->domainip = input.substr(pos_protocol + 3);
info->host = input.substr(pos_protocol + 3);
has_uri = 0;
} else {
pos_port = input.find_first_of(":", pos_protocol + 3);
Expand All @@ -60,9 +60,9 @@ return_t split_url(const char* url, url_info_t* info) {
info->port = 0;
}

info->domainip = input.substr(pos_protocol + 3, pos_uri - pos_protocol - 3);
info->host = input.substr(pos_protocol + 3, pos_uri - pos_protocol - 3);
} else {
info->domainip = input.substr(pos_protocol + 3, pos_port - pos_protocol - 3);
info->host = input.substr(pos_protocol + 3, pos_port - pos_protocol - 3);
info->port = atoi(input.substr(pos_port + 1, pos_uri - pos_port - 1).c_str());
}

Expand All @@ -88,6 +88,13 @@ return_t split_url(const char* url, url_info_t* info) {
info->urifile = input.substr(pos_uripath + 1);
}
}

if (info->uri.empty()) {
info->uri = "/";
}
if (info->uripath.empty()) {
info->uripath = "/";
}
}
__finally2 {
// do nothing
Expand Down
22 changes: 11 additions & 11 deletions sdk/io/string/string.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ return_t scan(const wchar_t* stream, size_t sizestream, size_t startpos, size_t*
//
typedef struct _url_info_t {
std::string protocol;
std::string domainip;
std::string host;
int port;
std::string uri;
std::string uripath;
Expand All @@ -173,21 +173,21 @@ typedef struct _url_info_t {
* const char *url = "http://test.com/download/meta/file.txt";
* split_url(url, &info);
* // info.protocol => http
* // info.domainip => test.com
* // info.host => test.com
* // info.port => 80
* // info.uri => /download/meta/file.txt
* // info.uripath => download/meta
* // info.urifile => file.txt
* @remarks
* input -> prot / domainip / uripath / urifile
* http://test.com/download/file.txt -> http / test.com / download / file.txt
* http://test.com/download/ -> http / test.com / download / NA
* http://test.com/download -> http / test.com / NA / download
* http://test.com/a/b/ -> http / test.com / a/b / NA
* http://test.com/a/b -> http / test.com / a / b
* http://test.com -> http / test.com / NA / NA
* /download/file.txt -> NA / NA / download / file.txt
* /download/ -> NA / NA / download / N/A
* input -> prot + host + uripath + urifile
* http://test.com/download/file.txt -> http + test.com + download + file.txt
* http://test.com/download/ -> http + test.com + download + NA
* http://test.com/download -> http + test.com + / + download
* http://test.com/a/b/ -> http + test.com + a/b + NA
* http://test.com/a/b -> http + test.com + a + b
* http://test.com -> http + test.com + / + NA
* /download/file.txt -> NA + NA + download + file.txt
* /download/ -> NA + NA + download + N/A
*/
return_t split_url(const char* url, url_info_t* info);

Expand Down
3 changes: 2 additions & 1 deletion sdk/io/string/string_charset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ return_t scan(const wchar_t* stream, size_t sizestream, size_t startpos, size_t*
if (p < epos) {
*brk = startpos + p - pos + 1;
} else {
ret = errorcode_t::not_found;
*brk = sizestream;
// ret = errorcode_t::not_found;
}
}
__finally2 {
Expand Down
8 changes: 4 additions & 4 deletions sdk/net/basic/client_socket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class client_socket {
/**
* @brief connect
* @param socket_t* sock [OUT]
* @param tls_context_t** tls_handle [OUT] ignore
* @param tls_context_t** tls_handle [OUT]
* @param const char* address [IN]
* @param uint16 port [IN]
* @param uint32 timeout [IN]
Expand All @@ -38,15 +38,15 @@ class client_socket {
/**
* @brief close
* @param socket_t sock [IN] see connect
* @param tls_context_t* tls_handle [IN] ignore
* @param tls_context_t* tls_handle [IN]
* @return error code (see error.hpp)
*/
virtual return_t close(socket_t sock, tls_context_t* tls_handle);

/**
* @brief read
* @param socket_t sock [IN]
* @param tls_context_t* tls_handle [IN] ignore
* @param tls_context_t* tls_handle [IN]
* @param char* ptr_data [OUT]
* @param size_t size_data [IN]
* @param size_t* cbread [OUT]
Expand All @@ -56,7 +56,7 @@ class client_socket {
/**
* @brief send
* @param socket_t sock [IN]
* @param tls_context_t* tls_handle [IN] ignore
* @param tls_context_t* tls_handle [IN]
* @param const char* ptr_data [IN]
* @param size_t size_data [IN]
* @param size_t* size_sent [OUT]
Expand Down
Loading

0 comments on commit 0e89cf5

Please sign in to comment.