mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-12 08:50:04 -04:00
fix #3735
This commit is contained in:
parent
49ae4fe850
commit
a8ca37c55a
@ -524,12 +524,18 @@ object InternetCard {
|
|||||||
out.close()
|
out.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Finish the connection. Call getInputStream a second time below to re-throw any exception.
|
||||||
|
// This avoids getResponseCode() waiting for the connection to end in the synchronized block.
|
||||||
|
try {
|
||||||
|
http.getInputStream
|
||||||
|
} catch {
|
||||||
|
case _: Exception =>
|
||||||
|
}
|
||||||
|
|
||||||
HTTPRequest.this.synchronized {
|
HTTPRequest.this.synchronized {
|
||||||
response = Some((http.getResponseCode, http.getResponseMessage, http.getHeaderFields))
|
response = Some((http.getResponseCode, http.getResponseMessage, http.getHeaderFields))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calling getInputStream() can cause an exception to be thrown for unsuccessful HTTP responses,
|
|
||||||
// so call it only after the response code/message are set to allow retrieving them.
|
|
||||||
// TODO: This should allow accessing getErrorStream() for reading unsuccessful HTTP responses' output,
|
// TODO: This should allow accessing getErrorStream() for reading unsuccessful HTTP responses' output,
|
||||||
// but this would be a breaking change for existing OC code.
|
// but this would be a breaking change for existing OC code.
|
||||||
http.getInputStream
|
http.getInputStream
|
||||||
|
Loading…
x
Reference in New Issue
Block a user