Compare commits

...

2 Commits

Author SHA1 Message Date
Chee Yee 93fb338ce0 failed install to display server error message 2024-11-08 00:38:31 -08:00
Chee Yee 785a073bce fixed issue parse apache2 httpd directory listing using docker image 2024-10-26 15:31:01 -07:00
6 changed files with 43 additions and 15 deletions
+1 -1
View File
@@ -69,7 +69,7 @@ add_executable(ezremote_client
add_self(ezremote_client)
add_pkg(ezremote_client ${CMAKE_SOURCE_DIR}/data "RMTC00001" "ezRemote Client" "01.29" 32 0)
add_pkg(ezremote_client ${CMAKE_SOURCE_DIR}/data "RMTC00001" "ezRemote Client" "01.31" 32 0)
target_link_libraries(ezremote_client
c
+1 -1
View File
@@ -1157,7 +1157,7 @@ namespace Actions
int ret = tmp_client.Size(path, &bytes_to_download);
if (ret == 0)
{
sprintf(status_message, "%s - %s", lang_strings[STR_FAILED], lang_strings[STR_CANNOT_READ_PKG_HDR_MSG]);
sprintf(status_message, "%s", tmp_client.LastResponse());
tmp_client.Quit();
activity_inprogess = false;
Windows::SetModalMode(false);
+23 -10
View File
@@ -128,18 +128,31 @@ std::vector<DirEntry> ApacheClient::ListDir(const std::string &path)
tmp_string = std::string((const char *)value, value_len);
if (tmp_string.compare("td") == 0)
{
value = lxb_dom_node_text_content(node, &value_len);
// get the child <a> element
lxb_dom_node_t *a_node = NextChildElement(lxb_dom_interface_element(node));
if (a_node == nullptr) continue;
value = lxb_dom_element_local_name(lxb_dom_interface_element(a_node), &value_len);
tmp_string = std::string((const char *)value, value_len);
tmp_string = Util::Rtrim(tmp_string, "/");
sprintf(entry.name, "%s", tmp_string.c_str());
sprintf(entry.directory, "%s", path.c_str());
if (path.length() > 0 && path[path.length() - 1] == '/')
if (tmp_string.compare("a") == 0)
{
sprintf(entry.path, "%s%s", path.c_str(), entry.name);
}
else
{
sprintf(entry.path, "%s/%s", path.c_str(), entry.name);
value = lxb_dom_element_get_attribute(lxb_dom_interface_element(a_node), (const lxb_char_t *)"href", 4, &value_len);
tmp_string = std::string((const char *)value, value_len);
tmp_string = Util::Rtrim(tmp_string, "/");
tmp_string = BaseClient::UnEscape(tmp_string);
if (tmp_string.compare("..") != 0)
{
sprintf(entry.directory, "%s", path.c_str());
sprintf(entry.name, "%s", tmp_string.c_str());
if (path.length() > 0 && path[path.length() - 1] == '/')
{
sprintf(entry.path, "%s%s", path.c_str(), entry.name);
}
else
{
sprintf(entry.path, "%s/%s", path.c_str(), entry.name);
}
}
}
}
else continue; // not valid record
+5 -1
View File
@@ -90,7 +90,7 @@ int BaseClient::Size(const std::string &path, int64_t *size)
*size = atoll(content_length.c_str());
return 1;
}
else // Server doesn't support HEAD request. Try get range with 0 bytes and grab size from the response header
else if (res->status == 405)// Server doesn't support HEAD request. Try get range with 0 bytes and grab size from the response header
// example: Content-Range: bytes 0-10/4372785
{
Headers headers = {{"Range", "bytes=0-1"}};
@@ -111,6 +111,10 @@ int BaseClient::Size(const std::string &path, int64_t *size)
}
}
}
else
{
sprintf(this->response, "%d - %s", res->status, detail::status_message(res->status));
}
}
else
{
+2
View File
@@ -1898,6 +1898,8 @@ make_basic_authentication_header(const std::string &username,
namespace detail {
const char *status_message(int status);
std::string encode_query_param(const std::string &value);
std::string encode_url(const std::string &s);
+11 -2
View File
@@ -1292,7 +1292,7 @@ namespace HttpServer
failed(res, 200, lang_strings[STR_CANT_EXTRACT_URL_MSG]);
activity_inprogess = false;
file_transfering = false;
Windows::SetModalMode(true);
Windows::SetModalMode(false);
return;
}
delete(filehost);
@@ -1305,6 +1305,15 @@ namespace HttpServer
BaseClient *baseclient = new BaseClient();
baseclient->Connect(host, "", "");
if (!baseclient->FileExists(path))
{
failed(res, 200, baseclient->LastResponse());
activity_inprogess = false;
file_transfering = false;
Windows::SetModalMode(false);
return;
}
baseclient->Head(path, &header, sizeof(pkg_header));
if (BE32(header.pkg_magic) == 0x7F434E54)
@@ -1322,7 +1331,7 @@ namespace HttpServer
failed(res, 200, lang_strings[STR_FAIL_INSTALL_FROM_URL_MSG]);
activity_inprogess = false;
file_transfering = false;
Windows::SetModalMode(true);
Windows::SetModalMode(false);
return;
}
}