[maemo-commits] [maemo-commits] r16124 - in projects/haf/trunk/apt: debian methods
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Mon Sep 15 20:32:15 EEST 2008
- Previous message: [maemo-commits] r16123 - projects/haf/branches/hildon-thumbnail/daemonize/daemon
- Next message: [maemo-commits] r16125 - projects/haf/trunk/apt
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: marivoll Date: 2008-09-15 20:32:10 +0300 (Mon, 15 Sep 2008) New Revision: 16124 Modified: projects/haf/trunk/apt/debian/changelog projects/haf/trunk/apt/methods/http.cc Log: * Applied http-tablet-identification.patch Modified: projects/haf/trunk/apt/debian/changelog =================================================================== --- projects/haf/trunk/apt/debian/changelog 2008-09-15 17:20:33 UTC (rev 16123) +++ projects/haf/trunk/apt/debian/changelog 2008-09-15 17:32:10 UTC (rev 16124) @@ -2,6 +2,7 @@ * Applied maemostrip.patch * Applied postrip.patch + * Applied http-tablet-identification.patch -- Marius Vollmer <marius.vollmer at nokia.com> Mon, 15 Sep 2008 19:50:25 +0300 Modified: projects/haf/trunk/apt/methods/http.cc =================================================================== --- projects/haf/trunk/apt/methods/http.cc 2008-09-15 17:20:33 UTC (rev 16123) +++ projects/haf/trunk/apt/methods/http.cc 2008-09-15 17:32:10 UTC (rev 16124) @@ -631,7 +631,43 @@ return true; } /*}}}*/ +static const char * +get_osso_product_hardware () +{ + static char *product_hardware = NULL; + if (product_hardware) + return product_hardware; + + /* XXX - There is a library in maemo somewhere to do this, but it is + not included in the maemo SDK, so we have to do it + ourselves. Ridiculous, I know. + */ + + product_hardware = ""; + FILE *f = fopen ("/proc/component_version", "r"); + if (f) + { + char *line = NULL; + size_t len = 0; + ssize_t n; + + while ((n = getline (&line, &len, f)) != -1) + { + if (n > 0 && line[n-1] == '\n') + line[n-1] = '\0'; + + if (sscanf (line, "product %as", &product_hardware) == 1) + break; + } + + free (line); + fclose (f); + } + + return product_hardware; +} + // HttpMethod::SendReq - Send the HTTP request /*{{{*/ // --------------------------------------------------------------------- /* This places the http request in the outbound buffer */ @@ -714,6 +750,21 @@ if (Uri.User.empty() == false || Uri.Password.empty() == false) Req += string("Authorization: Basic ") + Base64Encode(Uri.User + ":" + Uri.Password) + "\r\n"; + else + { + const char *product_hardware = get_osso_product_hardware (); + if (product_hardware && product_hardware[0]) + { + /* This is a cookie that identifies Internet Tablets to the + server. We use the Authorization header since that is + easier to handle on the server side. + */ + string user = string ("NOKIA-OSSO-") + string (product_hardware); + Req += (string("Authorization: Basic ") + + Base64Encode(user + ":" + "JOSHUA") + + "\r\n"); + } + } Req += "User-Agent: Debian APT-HTTP/1.3 ("VERSION")\r\n\r\n";
- Previous message: [maemo-commits] r16123 - projects/haf/branches/hildon-thumbnail/daemonize/daemon
- Next message: [maemo-commits] r16125 - projects/haf/trunk/apt
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]