@@ -25,10 +25,6 @@ - (void)webView:(WKWebView *)webView startURLSchemeTask:(id <WKURLSchemeTask>)ur
2525 NSDictionary * header = urlSchemeTask.request .allHTTPHeaderFields ;
2626 NSMutableString * stringToLoad = [NSMutableString string ];
2727 [stringToLoad appendString: url.path];
28- if (url.query ) {
29- [stringToLoad appendString: @" ?" ];
30- [stringToLoad appendString: url.query];
31- }
3228 NSString * scheme = url.scheme ;
3329 NSString * method = urlSchemeTask.request .HTTPMethod ;
3430 NSData * body = urlSchemeTask.request .HTTPBody ;
@@ -39,13 +35,18 @@ - (void)webView:(WKWebView *)webView startURLSchemeTask:(id <WKURLSchemeTask>)ur
3935 if ([stringToLoad hasPrefix: @" /_app_file_" ]) {
4036 startPath = [stringToLoad stringByReplacingOccurrencesOfString: @" /_app_file_" withString: @" " ];
4137 } else if ([stringToLoad hasPrefix: @" /_http_proxy_" ]||[stringToLoad hasPrefix: @" /_https_proxy_" ]) {
38+ if (url.query ) {
39+ [stringToLoad appendString: @" ?" ];
40+ [stringToLoad appendString: url.query];
41+ }
4242 loadFile = false ;
4343 startPath = [stringToLoad stringByReplacingOccurrencesOfString: @" /_http_proxy_" withString: @" http://" ];
4444 // startPath = [stringToLoad stringByReplacingOccurrencesOfString:@"/_https_proxy_" withString:@"https://"];
4545 NSLog (@" Proxy %@ " , startPath);
46+ NSURL * requestUrl = [NSURL URLWithString: startPath];
4647 NSMutableURLRequest *request = [[NSMutableURLRequest alloc ] init ];
4748 [request setHTTPMethod: method];
48- [request setURL: [ NSURL URLWithString: startPath] ];
49+ [request setURL: requestUrl ];
4950 if (body) {
5051 [request setHTTPBody: body];
5152 }
@@ -57,7 +58,7 @@ - (void)webView:(WKWebView *)webView startURLSchemeTask:(id <WKURLSchemeTask>)ur
5758 if (error) {
5859 NSLog (@" Proxy error: %@ " , error);
5960 }
60-
61+
6162 [urlSchemeTask didReceiveResponse: response];
6263 [urlSchemeTask didReceiveData: data];
6364 [urlSchemeTask didFinish ];
0 commit comments