mirror of
https://github.com/Corewala/Buran
synced 2024-12-22 07:42:43 +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 headerLine = bufferedReader.readLine()
|
||||
|
||||
println("Buran: response header: $headerLine")
|
||||
println("Buran response header: $headerLine")
|
||||
|
||||
if(headerLine == null){
|
||||
if(currentRequestAddress == uri.toString()){
|
||||
|
@ -144,8 +144,9 @@ class GeminiDatasource(private val context: Context, val history: BuranHistory):
|
|||
|
||||
val header = GeminiResponse.parseHeader(headerLine)
|
||||
|
||||
if(currentRequestAddress == uri.toString()){
|
||||
currentRequestAddress = null
|
||||
when {
|
||||
currentRequestAddress != uri.toString() -> {}
|
||||
header.code == GeminiResponse.INPUT -> onUpdate(GemState.ResponseInput(uri, header))
|
||||
header.code == GeminiResponse.REDIRECT -> onUpdate(GemState.Redirect(header.meta))
|
||||
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
|
||||
bufferedReader.close()
|
||||
|
@ -172,7 +176,6 @@ class GeminiDatasource(private val context: Context, val history: BuranHistory):
|
|||
bufferedWriter.close()
|
||||
outWriter.close()
|
||||
|
||||
currentRequestAddress = null
|
||||
socket.close()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue