[BUG-16787] system.net.httpClient() HttpClient.Version customizer

I need to set my http clients version, similar to:


so I defined a customizer function to set it, but I cannot for the life of me figure out what I need to import or define so that I can specify the version parameter needed in the .version method.

Here is my callable, but I just cant seem to figure it out.

def clientCustomizer(client):
	return client.version(HttpClient.Version.versionOf("HTTP_1_1"))

If anyone has any ideas they are greatly appreciated!

Keith G.

The FQDN is java.net.http.HttpClient.Version, so you’ll probably have to import some part of that.

Maybe from java.net.http import HttpClient and then you can use HttpClient.Version.HTTP_1_1 in your script?

Looks like now its arguing that the HttpClientBuilderImpl class in jdk.internal.net does not want to work with the java.net.http stuff, but honestly I have no idea what I am saying lol. Any ideas?

Here is my customizer:

def clientCustomizer(client):
	from java.net.http import HttpClient

Here is the error (happening on the last line of the customizer):

java.lang.IllegalAccessException: java.lang.IllegalAccessException: class org.python.core.PyReflectedFunction cannot access class jdk.internal.net.http.HttpClientBuilderImpl (in module java.net.http) because module java.net.http does not export jdk.internal.net.http to unnamed module @382ab8

Hmm. This might no longer be something you’re doing wrong, but rather something we have to figure out and fix.

1 Like

Ugh, but its so much easier when I am the one thats wrong! lol

I appreciate the clarification though

Easier for me too, haha.


For posterity: It’s a known bug that we’ll have to correct internally. Unfortunately, until it is, the customizer for system.net.httpClient just doesn’t work.

1 Like

Running into the below error intermittitently… google seems to indicate its common across the new HTTPClient. Was going to try to force HTTP1.1 (https://stackoverflow.com/questions/59385349/java-11-httpclient-with-proxy-header-parser-received-no-bytes) but…

Caused by: java.io.IOException: HTTP/1.1 header parser received no bytes

Any updates on this bug? It’s one I’m running into as well. Is this planned to be fixed in the 8.0.x branch, or only in 8.1.x?

We were just talking about this last week, it’s still an active bug. When it’s fixed it will only be fixed in 8.1.x.


I’ve been scanning through the nightly changelogs and haven’t seen anything specifically mentioning this one. Is this still an active bug at this time?

I believe it’s still active.

If I remember what @PGriffith said there’s some tricky Java module system problem to solve that makes what seems like a trivial fix non-trivial for whatever reason.

I will add a note on the ticket that more people are running into this.