parent
d2f3ddf864
commit
a8a8ea10a1
|
@ -154,11 +154,11 @@ class BrowserWebViewController: UIViewController {
|
||||||
}
|
}
|
||||||
case let .success(response):
|
case let .success(response):
|
||||||
if response.status.isRedirect {
|
if response.status.isRedirect {
|
||||||
print("Trying to redirect to: '\(response.meta)'")
|
DispatchQueue.main.async {
|
||||||
if let redirect = URL(string: response.meta) {
|
print("Trying to redirect to: '\(response.meta)'")
|
||||||
self.navigator.changeURL(redirect)
|
if let redirect = URL(string: response.meta) {
|
||||||
} else {
|
self.navigator.changeURL(redirect)
|
||||||
DispatchQueue.main.async {
|
} else {
|
||||||
self.showError(message: "Invalid redirect URL: '\(response.meta)'")
|
self.showError(message: "Invalid redirect URL: '\(response.meta)'")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,11 +88,13 @@ class GeminiProtocol: NWProtocolFramerImplementation {
|
||||||
let header = GeminiResponseHeader(status: statusCode, meta: meta)
|
let header = GeminiResponseHeader(status: statusCode, meta: meta)
|
||||||
|
|
||||||
let message = NWProtocolFramer.Message(geminiResponseHeader: header)
|
let message = NWProtocolFramer.Message(geminiResponseHeader: header)
|
||||||
while true {
|
// What does the return value of deliverInputNoCopy mean, you ask? Why, I have no idea
|
||||||
if !framer.deliverInputNoCopy(length: .max, message: message, isComplete: true) {
|
// It always returns true for a length of zero, so following the sample code and looping
|
||||||
return 0
|
// infinitely until it returns false causes an infinite loop.
|
||||||
}
|
// Additionally, calling deliverInput with an empty Data() causes an error inside Network.framework.
|
||||||
}
|
// So, we just ignore the result since it doesn't seem to cause any problems ¯\_(ツ)_/¯
|
||||||
|
_ = framer.deliverInputNoCopy(length: statusCode.isSuccess ? .max : 0, message: message, isComplete: true)
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleOutput(framer: NWProtocolFramer.Instance, message: NWProtocolFramer.Message, messageLength: Int, isComplete: Bool) {
|
func handleOutput(framer: NWProtocolFramer.Instance, message: NWProtocolFramer.Message, messageLength: Int, isComplete: Bool) {
|
||||||
|
|
Loading…
Reference in New Issue