mirror of
https://github.com/Corewala/Buran
synced 2025-01-02 21:24:19 +00:00
Fixed redirect drop bug
This commit is contained in:
parent
0fdffee966
commit
73afc7c684
1 changed files with 20 additions and 17 deletions
|
@ -133,7 +133,7 @@ class GeminiDatasource(private val context: Context, val history: BuranHistory):
|
||||||
val bufferedReader = BufferedReader(headerInputReader)
|
val bufferedReader = BufferedReader(headerInputReader)
|
||||||
val headerLine = bufferedReader.readLine()
|
val headerLine = bufferedReader.readLine()
|
||||||
|
|
||||||
println("Buran: response header: $headerLine")
|
println("Buran response header: $headerLine")
|
||||||
|
|
||||||
if(headerLine == null){
|
if(headerLine == null){
|
||||||
if(currentRequestAddress == uri.toString()){
|
if(currentRequestAddress == uri.toString()){
|
||||||
|
@ -144,8 +144,9 @@ class GeminiDatasource(private val context: Context, val history: BuranHistory):
|
||||||
|
|
||||||
val header = GeminiResponse.parseHeader(headerLine)
|
val header = GeminiResponse.parseHeader(headerLine)
|
||||||
|
|
||||||
|
if(currentRequestAddress == uri.toString()){
|
||||||
|
currentRequestAddress = null
|
||||||
when {
|
when {
|
||||||
currentRequestAddress != uri.toString() -> {}
|
|
||||||
header.code == GeminiResponse.INPUT -> onUpdate(GemState.ResponseInput(uri, header))
|
header.code == GeminiResponse.INPUT -> onUpdate(GemState.ResponseInput(uri, header))
|
||||||
header.code == GeminiResponse.REDIRECT -> onUpdate(GemState.Redirect(header.meta))
|
header.code == GeminiResponse.REDIRECT -> onUpdate(GemState.Redirect(header.meta))
|
||||||
header.code == GeminiResponse.CLIENT_CERTIFICATE_REQUIRED -> onUpdate(GemState.ClientCertRequired(uri, header))
|
header.code == GeminiResponse.CLIENT_CERTIFICATE_REQUIRED -> onUpdate(GemState.ClientCertRequired(uri, header))
|
||||||
|
@ -162,6 +163,9 @@ class GeminiDatasource(private val context: Context, val history: BuranHistory):
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
println("Buran dropped response from $uri: request cancelled or superseded")
|
||||||
|
}
|
||||||
|
|
||||||
//Close input
|
//Close input
|
||||||
bufferedReader.close()
|
bufferedReader.close()
|
||||||
|
@ -172,7 +176,6 @@ class GeminiDatasource(private val context: Context, val history: BuranHistory):
|
||||||
bufferedWriter.close()
|
bufferedWriter.close()
|
||||||
outWriter.close()
|
outWriter.close()
|
||||||
|
|
||||||
currentRequestAddress = null
|
|
||||||
socket.close()
|
socket.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue