Closed myhrmans closed 1 year ago
Please see example repo and how to reproduce the error: https://github.com/myhrmans/tauri-wry-bug-xhr-error
Can confirm. Can't replicate the issue in windows. Seems to be working as intended.
After some more digging I found out that the request sent by wry has a header that is Content-Length: 0
Looking here: https://www.rfc-editor.org/rfc/rfc7230
A user agent SHOULD NOT send a Content-Length header field when the request message does not contain a payload body and the method semantics do not anticipate such a body.
Copying the request over into Postman and removing the Content-Length: 0
makes the request return a 200.
I had a conversation with @myhrmans in discord and reached to the conclusion that this seems to be a bug in webkit2gtk.
In order to reproduce this issue, we use webkit2gtk-rs
basic example:
webkit2gtk-rs
repo:
git clone https://github.com/tauri-apps/webkit2gtk-rs
examples/main.rs
to this (simply point the webview to https://figma.com/mirror):
extern crate gio;
extern crate glib;
extern crate gtk;
extern crate webkit2gtk;
use glib::ToVariant; use gtk::{prelude::*, Inhibit, Window, WindowType};
use webkit2gtk::UserContentManager; use webkit2gtk::{ traits::{SettingsExt, WebContextExt, WebViewExt}, WebContext, WebView, };
fn main() { gtk::init().unwrap();
let window = Window::new(WindowType::Toplevel); let context = WebContext::default().unwrap();
context.set_web_extensions_initialization_user_data(&"webkit".to_variant()); context.set_web_extensions_directory("../webkit2gtk-webextension-rs/example/target/debug/");
let webview = WebView::new_with_context_and_user_content_manager(&context, &UserContentManager::new());
let webview = WebView::with_context(&context); webview.load_uri("https://figma.com/mirror"); window.add(&webview);
let settings = WebViewExt::settings(&webview).unwrap(); settings.set_enable_developer_extras(true);
/let inspector = webview.get_inspector().unwrap(); inspector.show();/
window.show_all();
webview.run_javascript("alert('Hello');", None::<&gio::Cancellable>, |_result| {});
webview.run_javascript("42", None::<&gio::Cancellable>, |result| match result { Ok(result) => { let value = result.js_value(); println!("is_boolean: {}", value.is_boolean(&context)); println!("is_number: {}", value.is_number(&context)); println!("{:?}", value.to_number(&context)); println!("{:?}", value.to_boolean(&context)); } Err(error) => println!("{}", error), });
let cancellable = gio::Cancellable::new(); webview.run_javascript("42", Some(&cancellable), |result| match result { Ok(result) => { let context = result.global_context().unwrap(); let value = result.value().unwrap(); println!("is_boolean: {}", value.is_boolean(&context)); println!("is_number: {}", value.is_number(&context)); println!("{:?}", value.to_number(&context)); println!("{:?}", value.to_boolean(&context)); } Err(error) => println!("{}", error), });
window.connect_deleteevent(|, _| { gtk::main_quit(); Inhibit(false) });
gtk::main(); }
3. When the webview opens, click `Log In with SAML SSO` button
4. enter `martin.myhrman@volvocars.com` in the email field
5. check console for the error
The annoying thing is that same reproduction works fine in Gnome Web (previously called Epiphany) which depends on webkit2gtk. cc @wusyong
I tested with plan C and can confirm the same error :/ https://github.com/wusyong/gtkbrowser
Bugreport in webkit: https://bugs.webkit.org/show_bug.cgi?id=247970#c2
Seems to be a problem in soup2, a fix is already present in soup3. So upgrading to soup3 would solve this issue.
Describe the bug Have an issue in the wry window where I can't seem to make a XHR request when trying to sign in to a service.
The specific service Im trying to sign into is https://figma.com/mirror using SAML SSO.
Steps To Reproduce On Linux clone this repository https://github.com/myhrmans/tauri-wry-bug-xhr-error Then follow the instructions in the repo.
Platform and Versions (please complete the following information): OS: Ubuntu 22.04.1 LTS Rustc: rustc 1.64.0 (a55dd71d5 2022-09-19)
Would you assign yourself to resolve this bug?
Additional context This issue is only present on systems using the webkitgtk as far as I have tested. webview2 does not have this issue.