I'm trying to use soup for a http GET request in vala, but always return a Status code 6, in the manifest file I have the permission "--share=network"
I don't know what the problem is, if I need to have an additional permission to make server requests or is it part of the security of flatpak?
// Vala code
var session = new Soup.Session();
var uri = "https://jsonplaceholder.typicode.com/todos/var message = new Soup.Message ("GET",session.queue_message (message, (sess, mess) =>
// Process the result:
print ("Status Code: %u\n", mess.status_code);
print ("Message length: %lld\n", mess.response_body.length);
}
// Manifest file
{
"app-id": "com.github.calo001.fondo",
"base": "io.elementary.
"base-version": "juno",
"runtime": "org.freedesktop.Platform",
"sdk": "org.freedesktop.Sdk",
"runtime-version": "18.08",
"command": "com.github.calo001.fondo",
"finish-args": [
/* X11 + XShm */
"--share=ipc", "--socket=x11",
/* Wayland */
"--socket=wayland",
/* Network */
"--share=network",
/* dconf */
"--filesystem=xdg-run/dconf", "--filesystem=~/.config/dconf:ro",
"--talk-name=ca.desrt.dconf", "--env=DCONF_USER_CONFIG_DIR=.config/dconf"
],
"modules": [
{
"name": "fondo",
"buildsystem": "meson",
"config-opts": ["--buildtype=release"],
"sources":[
{
"type": "git",
"url": "https://github.com/calo001/fondo.git"
}
]
}
]
}
From soup-status.h status code 6 is SOUP_STATUS_SSL_FAILED
. So the first thing to try would be using http
instead of https
. By the way your Soup.Message
sample is showing "POST"
, but you say you are trying to make a GET request. You could also use Soup.Message.get_https_status
to get more details on the HTTPS request failure.