use of com.android.hotspot2.utils.HTTPRequest in project platform_frameworks_base by android.
the class HTTPHandler method httpExchange.
private HTTPResponse httpExchange(URL url, String message, HTTPMessage.Method method, String contentType) throws IOException {
HTTPRequest request = new HTTPRequest(message, mCharset, method, url, contentType, false);
request.send(mOut);
HTTPResponse response = new HTTPResponse(mIn);
Log.d(OSUManager.TAG, "HTTP code " + response.getStatusCode() + ", user " + mUser + ", pw " + (mPassword != null ? '\'' + new String(mPassword) + '\'' : "-"));
if (response.getStatusCode() == 401) {
if (mUser == null) {
throw new IOException("Missing user name for HTTP authentication");
}
try {
request = new HTTPRequest(message, StandardCharsets.ISO_8859_1, method, url, contentType, true);
request.doAuthenticate(response, mUser, mPassword, url, sSequence.incrementAndGet());
request.send(mOut);
mHTTPAuthPerformed = true;
} catch (GeneralSecurityException gse) {
throw new IOException(gse);
}
response = new HTTPResponse(mIn);
}
return response;
}
use of com.android.hotspot2.utils.HTTPRequest in project android_frameworks_base by ResurrectionRemix.
the class HTTPHandler method httpExchange.
private HTTPResponse httpExchange(URL url, String message, HTTPMessage.Method method, String contentType) throws IOException {
HTTPRequest request = new HTTPRequest(message, mCharset, method, url, contentType, false);
request.send(mOut);
HTTPResponse response = new HTTPResponse(mIn);
Log.d(OSUManager.TAG, "HTTP code " + response.getStatusCode() + ", user " + mUser + ", pw " + (mPassword != null ? '\'' + new String(mPassword) + '\'' : "-"));
if (response.getStatusCode() == 401) {
if (mUser == null) {
throw new IOException("Missing user name for HTTP authentication");
}
try {
request = new HTTPRequest(message, StandardCharsets.ISO_8859_1, method, url, contentType, true);
request.doAuthenticate(response, mUser, mPassword, url, sSequence.incrementAndGet());
request.send(mOut);
mHTTPAuthPerformed = true;
} catch (GeneralSecurityException gse) {
throw new IOException(gse);
}
response = new HTTPResponse(mIn);
}
return response;
}
use of com.android.hotspot2.utils.HTTPRequest in project android_frameworks_base by DirtyUnicorns.
the class HTTPHandler method httpExchange.
private HTTPResponse httpExchange(URL url, String message, HTTPMessage.Method method, String contentType) throws IOException {
HTTPRequest request = new HTTPRequest(message, mCharset, method, url, contentType, false);
request.send(mOut);
HTTPResponse response = new HTTPResponse(mIn);
Log.d(OSUManager.TAG, "HTTP code " + response.getStatusCode() + ", user " + mUser + ", pw " + (mPassword != null ? '\'' + new String(mPassword) + '\'' : "-"));
if (response.getStatusCode() == 401) {
if (mUser == null) {
throw new IOException("Missing user name for HTTP authentication");
}
try {
request = new HTTPRequest(message, StandardCharsets.ISO_8859_1, method, url, contentType, true);
request.doAuthenticate(response, mUser, mPassword, url, sSequence.incrementAndGet());
request.send(mOut);
mHTTPAuthPerformed = true;
} catch (GeneralSecurityException gse) {
throw new IOException(gse);
}
response = new HTTPResponse(mIn);
}
return response;
}
use of com.android.hotspot2.utils.HTTPRequest in project android_frameworks_base by crdroidandroid.
the class HTTPHandler method httpExchange.
private HTTPResponse httpExchange(URL url, String message, HTTPMessage.Method method, String contentType) throws IOException {
HTTPRequest request = new HTTPRequest(message, mCharset, method, url, contentType, false);
request.send(mOut);
HTTPResponse response = new HTTPResponse(mIn);
Log.d(OSUManager.TAG, "HTTP code " + response.getStatusCode() + ", user " + mUser + ", pw " + (mPassword != null ? '\'' + new String(mPassword) + '\'' : "-"));
if (response.getStatusCode() == 401) {
if (mUser == null) {
throw new IOException("Missing user name for HTTP authentication");
}
try {
request = new HTTPRequest(message, StandardCharsets.ISO_8859_1, method, url, contentType, true);
request.doAuthenticate(response, mUser, mPassword, url, sSequence.incrementAndGet());
request.send(mOut);
mHTTPAuthPerformed = true;
} catch (GeneralSecurityException gse) {
throw new IOException(gse);
}
response = new HTTPResponse(mIn);
}
return response;
}
use of com.android.hotspot2.utils.HTTPRequest in project android_frameworks_base by AOSPA.
the class HTTPHandler method httpExchange.
private HTTPResponse httpExchange(URL url, String message, HTTPMessage.Method method, String contentType) throws IOException {
HTTPRequest request = new HTTPRequest(message, mCharset, method, url, contentType, false);
request.send(mOut);
HTTPResponse response = new HTTPResponse(mIn);
Log.d(OSUManager.TAG, "HTTP code " + response.getStatusCode() + ", user " + mUser + ", pw " + (mPassword != null ? '\'' + new String(mPassword) + '\'' : "-"));
if (response.getStatusCode() == 401) {
if (mUser == null) {
throw new IOException("Missing user name for HTTP authentication");
}
try {
request = new HTTPRequest(message, StandardCharsets.ISO_8859_1, method, url, contentType, true);
request.doAuthenticate(response, mUser, mPassword, url, sSequence.incrementAndGet());
request.send(mOut);
mHTTPAuthPerformed = true;
} catch (GeneralSecurityException gse) {
throw new IOException(gse);
}
response = new HTTPResponse(mIn);
}
return response;
}
Aggregations