g_file_read fails when running on a remote machine via ssh
- From: Jim George <jimgeorge gmail com>
- To: gtk-list gnome org
- Subject: g_file_read fails when running on a remote machine via ssh
- Date: Tue, 8 Feb 2011 12:19:29 -0700
Hi all,
In a larger GTK application that needs to do HTTP gets, I replaced use
of cURL and some helper functions called "glibcurl" with GIO calls. I
now face a strange problem that when the program runs locally,
everything is fine, but when run over an SSH tunnel with X forwarding,
the call to g_file_read fails, with a GError->message of "Operation
not supported".
To investigate this further, I wrote a small test program pasted below:
#include <glib.h>
#include <gio/gio.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
char url[256] = "http://www.google.com";
GFile *file;
GFileInputStream *istream;
GError *err = NULL;
if (argc > 1) {
strncpy(url, argv[1], 256);
}
printf("Opening %s\n", url);
file = g_file_new_for_uri(url);
istream = g_file_read(file, NULL, &err);
if (err != NULL) {
g_error("Could not open %s for reading: %s\n", url, err->message);
g_error_free(err);
return 1;
}
g_input_stream_close(G_INPUT_STREAM(istream), NULL, &err);
g_object_unref(file);
return 0;
}
I compiled this using: gcc -g -O0 `pkg-config --cflags --libs gio-2.0
gtk+-2.0` -o test test.c
Running ./test locally gives me the "Opening http://www.google.com"
message, and a normal exit.
When I run the program on a different machine, to which I have opened
an ssh connection, I get this:
Opening http://www.google.com
** ERROR **: Could not open http://www.google.com for reading:
Operation not supported
aborting...
Aborted (core dumped)
This matches the behavior on my main gtk program. As a test, the
behavior of the test program is identical when trying to access a text
file on one of our local web servers.
I couldn't find much documentation on gfile and gio by way of a
tutorial, so I'm pretty much feeling my way around right now. What am
I doing wrong?
-Jim
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]