MixinNetwork / MixinNetwork/flutter-plugins
Does not send HTTP requests in Linux
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 512
- Forks
- 292
- Avg merge
- 15h 8m
- Merged PRs (30d)
- 7
Description
I have created an App (in Windows and Linux) that on the one side creates a web service listenning to HTTP requests on port 4000. That part is working find since I have check on a web browser also using curl that the service responds to requests. It also works from a specific web-page I have created sending HTTP using "fetch" in javascript each time a press a button when that web page is accessed via a web-browser (i.e.: firefox).
Now, I want to develop another app (or even in the same app that's not relevant) that uses desktop_webview_window plugin to open the web-page before mentioned. In Windows, it works as expected, I am able to receive HTTP request on the web service side. But if I run the same flutter code in Linux (Ubuntu 22.04), the web service does not receive any request (no print is reported in the console). Indeed, I have monitored the traffic on the specific port when I sue the desktop_webivew_window pluging and nothing is even sent from the plugin to the web service, so tcpdump reports no HTTP traffic at that specific port and interface.
Reproduce Steps
The web service is created using shelf_io:
Future createServer(){
final headers = {
'Access-Control-Allow-Origin': '*',
'Content-Type': 'application/json;'
};
var handler =
const Pipeline().addMiddleware(corsHeaders(headers: headers)).addHandler(clientRequest);
return shelf_io.serve(handler, 'localhost', 4000);
}
Future clientRequest(Request request)
async {
String path = request.url.path;
debugPrint(path);
return Response.ok(jsonEncode({"result": "OK"}));
}
While the webview is lauched as:
final webview= await WebviewWindow.create(configuration: CreateConfiguration(
windowHeight: window.physicalSize.height.toInt(),
windowWidth: window.physicalSize.width.toInt(),
title: title));
webview.launch(url);
In the web page with the URL indicated in the lauch method I have a javascript code that basically sends the HTTP to the web service by:
var url='http://localhost:4000';
const response = await fetch(url, {method: 'POST',headers: {'Content-Type': 'application/json'},body: {}});
const r = await response.json();
console.log(r);
Version (please complete the following information):
- Flutter Version: [e.g. v3.16.3]
- OS: [e.g. Windows/Linux]
- plugin: [e.g. desktop_webview_window: 0.2.1]
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue on Ubuntu 22.04 using desktop_webview_window, the shelf_io server on localhost:4000, and the page's JavaScript fetch call; compare the behavior with Windows. Check whether tcpdump shows traffic from the webview, and consider the issue resolved when the request reaches the service or the Linux limitation is clearly documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- flutter, javascript
- Domain
- desktop, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100