3
3
#include < include/cef_parser.h>
4
4
5
5
#include " browser-scheme.hpp"
6
+ #include " obs.h"
6
7
7
8
8
9
BrowserSchemeHandlerFactory::BrowserSchemeHandlerFactory ()
@@ -33,18 +34,20 @@ bool BrowserSchemeHandler::ProcessRequest(CefRefPtr<CefRequest> request,
33
34
CefURLParts parts;
34
35
CefParseURL (request->GetURL (), parts);
35
36
36
- std::string path = CefString (&parts.path );
37
-
38
- // Set fileName for use in GetResponseHeaders
39
- fileName = path;
37
+ std::wstring path = CefString (&parts.path );
40
38
41
39
path = CefURIDecode (path, true , cef_uri_unescape_rule_t ::UU_SPACES);
42
- path = CefURIDecode (path, true , cef_uri_unescape_rule_t ::UU_NORMAL );
40
+ path = CefURIDecode (path, true , cef_uri_unescape_rule_t ::UU_URL_SPECIAL_CHARS_EXCEPT_PATH_SEPARATORS );
43
41
#ifdef WIN32
42
+ // blog(LOG_INFO, "%s", path.erase(0,1));
44
43
inputStream.open (path.erase (0 ,1 ), std::ifstream::binary);
45
44
#else
46
45
inputStream.open (path, std::ifstream::binary);
47
46
#endif
47
+
48
+ // Set fileName for use in GetResponseHeaders
49
+ fileName = path;
50
+
48
51
if (!inputStream.is_open ()) {
49
52
callback->Cancel ();
50
53
return false ;
@@ -66,11 +69,11 @@ void BrowserSchemeHandler::GetResponseHeaders(CefRefPtr<CefResponse> response,
66
69
return ;
67
70
}
68
71
69
- std::string fileExtension = fileName.substr (
70
- fileName.find_last_of (" ." ) + 1 );
72
+ std::wstring fileExtension = fileName.substr (
73
+ fileName.find_last_of (L " ." ) + 1 );
71
74
72
- if (fileExtension == " woff2 " ) {
73
- fileExtension = " woff" ;
75
+ if (fileExtension. compare ( L" woff2 " ) == 0 ) {
76
+ fileExtension = L " woff" ;
74
77
}
75
78
76
79
std::transform (fileExtension.begin (), fileExtension.end (),
0 commit comments