Skip to content

Conversation

alex-james-dev
Copy link
Contributor

@alex-james-dev alex-james-dev commented Jul 12, 2023

Hey @brianquinlan,

The tests are passing when I run locally on my machine, but they are failing when run on the GitHub workflow 🤔

Context

This is a PR for the java_http GSoC '23 project 🌞.
Relevant tracking issue: #957.

Purpose

The purpose of this PR is to improve the implementation of the send method of JavaClient (a subclass of package:http BaseClient). This takes us closer to our goal of JavaClient passing all the tests in package:http_client_conformance_tests.

Changes

In this PR we:

  • Connect to the URL.

  • Set the request headers to those given in BaseRequest.headers.

  • Set the request method to the given method in BaseRequest.method.

  • Send the request.

  • Retrieve the status code, reason phrase, response headers, content length and response body.


  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.

@alex-james-dev
Copy link
Contributor Author

alex-james-dev commented Jul 14, 2023

Hey @brianquinlan, I reverted the commits made to track down the reason the GitHub workflow was failing. It looks like the reason was that the Java client was trying to connect to localhost using IPv4 but the HttpServer was only accepting connections to localhost by IPv6. 🤔

I made a new commit to fix the bug by setting the Java client to prefer IPv6 using the system property:

System.setProperty('java.net.preferIPv6Addresses'.toJString(), 'true'.toJString());

No changes were made to package:http_conformance_tests.
I used jnigen to generate bindings for the System class so that we can call the setProperty method.

The following package:http_conformance_tests are now passing 🎉:

  • testResponseBody
  • testResponseHeaders
  • testRequestHeaders
  • testMultipleClients

Thank you for your help!

@brianquinlan brianquinlan self-assigned this Jul 17, 2023
@alex-james-dev alex-james-dev marked this pull request as ready for review July 17, 2023 19:14
@brianquinlan brianquinlan merged commit db276f8 into dart-lang:master Jul 21, 2023
@alex-james-dev alex-james-dev deleted the java-http-send-method branch July 24, 2023 15:20
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

Successfully merging this pull request may close these issues.

2 participants