Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apache Enginge: Auth scheme may not be null #1255

Closed
F3adlz opened this issue Jul 31, 2019 · 4 comments
Closed

Apache Enginge: Auth scheme may not be null #1255

F3adlz opened this issue Jul 31, 2019 · 4 comments
Assignees

Comments

@F3adlz
Copy link

F3adlz commented Jul 31, 2019

Ktor Version and Engine Used (client or server and name)
io.ktor:ktor-client-apache:1.2.3-rc
io.ktor:ktor-client-apache:1.2.2
org.apache.httpcomponents:httpasyncclient:4.1.3

Describe the bug
When using Ktor http client with http proxy (with basic auth), some of requests to https web sites are failing with "java.lang.IllegalArgumentException: Auth scheme may not be null":

java.lang.IllegalArgumentException: Auth scheme may not be null

	at |b|b|b(Coroutine boundary.|b(|b)
	at io.ktor.client.engine.apache.ApacheEngine.execute(ApacheEngine.kt:23)
	at io.ktor.client.engine.HttpClientEngine$install$1.invokeSuspend(HttpClientEngine.kt:49)
	at io.ktor.client.features.logging.Logging$Companion$install$1.invokeSuspend(Logging.kt:151)
	at io.ktor.client.features.HttpSend$DefaultSender.execute(HttpSend.kt:90)
	at io.ktor.client.features.HttpSend$Feature$install$1.invokeSuspend(HttpSend.kt:62)
	at io.ktor.client.features.HttpCallValidator$Companion$install$1.invokeSuspend(HttpCallValidator.kt:87)
	at io.ktor.client.HttpClient.execute(HttpClient.kt:141)
	at io.ktor.client.call.HttpClientCallKt.call(HttpClientCall.kt:140)
	at t.p.s.f.BugReportTest$getNested$2$1$1.invokeSuspend(BugReportTest.kt:59)
	at t.p.s.f.BugReportTest$testClient$1$1$1.invokeSuspend(BugReportTest.kt:83)
Caused by: java.lang.IllegalArgumentException: Auth scheme may not be null
	at org.apache.http.util.Args.notNull(Args.java:54)
	at org.apache.http.impl.client.AuthenticationStrategyImpl.authSucceeded(AuthenticationStrategyImpl.java:215)
	at org.apache.http.impl.client.ProxyAuthenticationStrategy.authSucceeded(ProxyAuthenticationStrategy.java:44)
	at org.apache.http.impl.auth.HttpAuthenticator.isAuthenticationRequested(HttpAuthenticator.java:88)
	at org.apache.http.impl.nio.client.MainClientExec.needAuthentication(MainClientExec.java:629)
	at org.apache.http.impl.nio.client.MainClientExec.handleResponse(MainClientExec.java:569)
	at org.apache.http.impl.nio.client.MainClientExec.responseReceived(MainClientExec.java:309)
	at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.responseReceived(DefaultClientExchangeHandlerImpl.java:151)
	at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.responseReceived(HttpAsyncRequestExecutor.java:306)
	at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:255)
	at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:81)
	at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:39)
	at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:121)
	at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162)
	at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337)
	at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315)
	at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276)
	at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104)
	at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:588)
	at java.lang.Thread.run(Thread.java:748)

To Reproduce
Steps to reproduce the behavior:

  1. Run following test with http proxy (with basic auth) BugReportTest. Number of parallel requests until exception may differ.

Expected behavior
No errors or exceptions occurred.

@F3adlz F3adlz added the bug label Jul 31, 2019
@e5l e5l self-assigned this Aug 1, 2019
@e5l
Copy link
Member

e5l commented Aug 1, 2019

Hi @F3adlz, thanks for the report.
It looks like you handle cookies and Auth inside the Apache configuration, so ktor can't do anything with that.

Btw maybe ktor auth feature could fix this problem https://ktor.io/clients/http-client/features/auth.html ?

@e5l e5l removed the bug label Aug 1, 2019
@F3adlz
Copy link
Author

F3adlz commented Aug 1, 2019

@e5l, thanks for suggestion, but does it work for proxy authentication? Because i've got io.ktor.client.features.ClientRequestException: Client request(https://jsonplaceholder.typicode.com/) invalid: 407 Proxy Authentication Required using Auth feature and setting proxy server address in Apache configuration.

@F3adlz
Copy link
Author

F3adlz commented Aug 4, 2019

Related issue with proxy authentication #760

@e5l
Copy link
Member

e5l commented Jun 4, 2020

This issue is inside of the apache-async-httpclient library. I made the separate issue for proxy Auth in multiplatform: #1923

Closed.

@e5l e5l closed this as completed Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants