Commit 25c46342 authored by Andy Hertzfeld's avatar Andy Hertzfeld

tweaked configuration upload protocol to match Jonathan's changes


       tweaked configuration upload protocol to match Jonathan's changes
parent 08d18d65
2000-04-11 Andy Hertzfeld <andy@eazel.com>
* components/services/startup/eazel-register.c:
added hostname to configuration node to distinguish machines when
the user has more than one
* components/services/startup/nautilus-service-startup-view.c:
changed protocol for configuration upload to match Jonathans's new
cgi; configuration upload is now working with Jonathan's stuff!
2000-04-11 Darin Adler <darin@eazel.com>
* libnautilus/nautilus-directory.c
......
......@@ -28,6 +28,7 @@
#include <stdio.h>
#include <fcntl.h>
#include <time.h>
#include <unistd.h>
#include <rpm/rpmlib.h>
#include <gnome.h>
#include <gnome-xml/entities.h>
......@@ -242,15 +243,18 @@ xmlDoc* create_configuration_metafile()
time_t current_time;
xmlNode *container_node;
gchar *time_string;
gchar host_name[512];
xmlDoc *configuration_metafile = xmlNewDoc((const CHAR*)"1.0");
gethostname(&host_name[0], 511);
container_node = xmlNewDocNode(configuration_metafile, NULL, (const CHAR*) "CONFIGURATION", NULL);
configuration_metafile->root = container_node;
time(&current_time);
time_string = strdup(ctime(&current_time));
time_string[strlen(time_string) - 1] = '\0';
xmlSetProp(container_node, "computer", host_name);
xmlSetProp(container_node, "date", time_string);
g_free(time_string);
......
......@@ -31,6 +31,7 @@
#include "eazel-register.h"
#include <ghttp.h>
#include <unistd.h>
#include <gnome-xml/tree.h>
#include <libnautilus/nautilus-background.h>
#include <libnautilus/nautilus-gtk-macros.h>
......@@ -182,8 +183,8 @@ static void
gather_config_button_cb (GtkWidget *button, NautilusServicesContentView *view)
{
FILE* config_file;
gchar buffer[256];
gchar *config_file_name, *config_string, *uri, *response_str;
gchar buffer[256], host_name[512];
gchar *config_file_name, *config_string, *uri, *response_str, *cookie_str;
GString* config_data;
xmlDocPtr config_doc;
ghttp_request *request;
......@@ -223,9 +224,13 @@ gather_config_button_cb (GtkWidget *button, NautilusServicesContentView *view)
/* send the config file to the server via HTTP */
/* FIXME: need to url-encode the arguments here */
uri = g_strdup_printf("http://%s/set.pl", SERVICE_DOMAIN_NAME);
uri = g_strdup_printf("http://%s/profile/set.pl", SERVICE_DOMAIN_NAME);
gethostname(&host_name[0], 511);
cookie_str = g_strdup_printf("token=%s; computer=%s", view->details->auth_token, host_name);
request = make_http_post_request(uri, config_string, cookie_str);
g_free(cookie_str);
request = make_http_post_request(uri, config_string, view->details->auth_token);
response_str = ghttp_get_body(request);
g_free(uri);
ghttp_request_destroy(request);
......@@ -283,7 +288,7 @@ register_button_cb (GtkWidget *button, NautilusServicesContentView *view)
body = g_strdup_printf("email=%s&pwd=%s", email, password);
uri = g_strdup_printf("http://%s/member/new.pl", SERVICE_DOMAIN_NAME);
request = make_http_post_request(uri, body, view->details->auth_token);
request = make_http_post_request(uri, body, NULL);
response_str = ghttp_get_body(request);
/* handle the error response */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment