From dsdrake@gmail.com Thu Sep 5 19:05:37 2013 Return-Path: X-Original-To: libsoup-list@gnome.org Delivered-To: libsoup-list@gnome.org Received: from localhost (localhost.localdomain [127.0.0.1]) by restaurant.gnome.org (Postfix) with ESMTP id 3F018765B9 for ; Thu, 5 Sep 2013 19:05:37 +0000 (UTC) X-Virus-Scanned: by amavisd-new at gnome.org X-Spam-Flag: NO X-Spam-Score: -2.6 X-Spam-Level: X-Spam-Status: No, score=-2.6 tagged_above=-999 required=2 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=ham Received: from restaurant.gnome.org ([127.0.0.1]) by localhost (restaurant.gnome.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id is6JsDuV6fzF for ; Thu, 5 Sep 2013 19:05:32 +0000 (UTC) Received: from mail-qc0-f176.google.com (mail-qc0-f176.google.com [209.85.216.176]) by restaurant.gnome.org (Postfix) with ESMTP id 9489976946 for ; Thu, 5 Sep 2013 19:05:21 +0000 (UTC) Received: by mail-qc0-f176.google.com with SMTP id u20so1002437qcx.7 for ; Thu, 05 Sep 2013 12:05:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type; bh=pvdm3AzYNV9Ty55l9eaxAs6SjKA36f+KGBztApQS3ZU=; b=maupE0S4OTYlNxPBPqGCNh2m/b/8cNyxqyvelNofKtc5Q8QUQuY4DoQsDS8JYrBQ+0 SP0IkBda4vtzTCP/MJOPdFjyuWcahjwXEu3+O+A2MJbSiJpVjUbN4w9uD4RgI6oNrf9t 3u1t2SL6EDuBbWsf8y3/pJBgCj+qXlqlp1BE2jxOc6bY+GrwdDB15b6Pv8Uy9XsFqcRL MjK2iViS1z83YBdPaYxzuq1BeAzyRpyNO+gJCyFhL/vIi1GYkiYuTpIumzIymbwINIn7 dgUeKzx++VldNMQq0i7Bd1/j2yQbfsSfO3BFDWdzTU7bNOpVeXqghGE0iQlioVLRgYum kkqA== MIME-Version: 1.0 X-Received: by 10.224.127.196 with SMTP id h4mr11581953qas.59.1378407920344; Thu, 05 Sep 2013 12:05:20 -0700 (PDT) Sender: dsdrake@gmail.com Received: by 10.229.117.10 with HTTP; Thu, 5 Sep 2013 12:05:20 -0700 (PDT) Date: Thu, 5 Sep 2013 13:05:20 -0600 X-Google-Sender-Auth: nqS-onifb7tAycGPq5oTDErz3RU Message-ID: Subject: Retrieve final URL after redirection From: Daniel Drake To: libsoup-list@gnome.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: libsoup-list@gnome.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "discussion of libsoup, an HTTP library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Sep 2013 19:05:37 -0000 Hi, I am using soup in Sugar to download a simple webpage over HTTP. This page includes some links that I parse. Some of those links are relative e.g. . If I then go on to download the content pointed to, I have to resolve that relative link to something absolute. To resolve relative links like that, I need to know the URL that the webpage came from. And that is not necessarily the same as the URL I requested with soup, because of any HTTP redirects that might have happened. What is the best way to get the real URL of the completed SoupMessage after all redirection has happened? Is there something better than adding an intermediate header handler for the Location header and recording the URL of the most recent redirect myself? That might even be a bit complicated as apparently Location header can maybe include relative URLs themselves, see http://en.wikipedia.org/wiki/HTTP_location Thanks Daniel From danw@gnome.org Fri Sep 6 01:25:06 2013 Return-Path: X-Original-To: libsoup-list@gnome.org Delivered-To: libsoup-list@gnome.org Received: from localhost (localhost.localdomain [127.0.0.1]) by restaurant.gnome.org (Postfix) with ESMTP id F07F276579 for ; Fri, 6 Sep 2013 01:25:06 +0000 (UTC) X-Virus-Scanned: by amavisd-new at gnome.org X-Spam-Flag: NO X-Spam-Score: -1.121 X-Spam-Level: X-Spam-Status: No, score=-1.121 tagged_above=-999 required=2 tests=[BAYES_00=-1.9, SPF_NEUTRAL=0.779] autolearn=no Received: from restaurant.gnome.org ([127.0.0.1]) by localhost (restaurant.gnome.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NNIl_SgDqNKS for ; Fri, 6 Sep 2013 01:25:02 +0000 (UTC) Received: from mysterion.org (mysterion.org [66.228.43.119]) by restaurant.gnome.org (Postfix) with ESMTP id 0946676303 for ; Fri, 6 Sep 2013 01:24:51 +0000 (UTC) Message-ID: <52292ED5.8040800@gnome.org> Date: Thu, 05 Sep 2013 21:24:37 -0400 From: Dan Winship User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8 MIME-Version: 1.0 To: Daniel Drake Subject: Re: Retrieve final URL after redirection References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: libsoup-list@gnome.org X-BeenThere: libsoup-list@gnome.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "discussion of libsoup, an HTTP library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Sep 2013 01:25:07 -0000 On 09/05/2013 03:05 PM, Daniel Drake wrote: > What is the best way to get the real URL of the completed SoupMessage > after all redirection has happened? The SoupMessage's URI gets updated when a redirect happens, so just call soup_message_get_uri() (or read the "uri" property), and then use that with soup_uri_new_with_base() to resolve the relative link. -- Dan From dsdrake@gmail.com Sat Sep 7 14:19:54 2013 Return-Path: X-Original-To: libsoup-list@gnome.org Delivered-To: libsoup-list@gnome.org Received: from localhost (localhost.localdomain [127.0.0.1]) by restaurant.gnome.org (Postfix) with ESMTP id 373867695A; Sat, 7 Sep 2013 14:19:54 +0000 (UTC) X-Virus-Scanned: by amavisd-new at gnome.org X-Spam-Flag: NO X-Spam-Score: -2.6 X-Spam-Level: X-Spam-Status: No, score=-2.6 tagged_above=-999 required=2 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=ham Received: from restaurant.gnome.org ([127.0.0.1]) by localhost (restaurant.gnome.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YuFdbdwY6wQ2; Sat, 7 Sep 2013 14:19:50 +0000 (UTC) Received: from mail-qc0-f179.google.com (mail-qc0-f179.google.com [209.85.216.179]) by restaurant.gnome.org (Postfix) with ESMTP id E29C876303; Sat, 7 Sep 2013 14:19:38 +0000 (UTC) Received: by mail-qc0-f179.google.com with SMTP id l4so2307286qcv.24 for ; Sat, 07 Sep 2013 07:19:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=zAhRd2V/lougIFD4chBKK/dRVWBIUpmkdrm82+iQz8Q=; b=cMuHscmWSomJgH/MZHRhAYinN5CB8n9Cj+DvsNLHIepe3BySF8MScD+0TmsdTkCtwg WwSP+wODslU5Xvnig2qeyFg+tiJ2XKXt/boTmAA8qP3P5Yz07D9BsUwy4oS/lX7Xu6Gg R4zevj6XgemqZOkEfgkl666vbYzFeAFeYGXER8JkoVCYqu4nc7hzpKijF0Ulg2cLmWsV lk69xv63NAbWJt7lPSswOX4KQROK5eUYron1p3OZK9Gbyt+DrX6u+Pv3ChgSRmE9Vx5o f9RrK1gBGtWs7y6IyqZ6hbc/77k0Do16KrG5lAzm5peVS4+2Oo8/oSgPyvP382rmZZEd 4HZQ== MIME-Version: 1.0 X-Received: by 10.49.116.178 with SMTP id jx18mr1274750qeb.81.1378563576567; Sat, 07 Sep 2013 07:19:36 -0700 (PDT) Sender: dsdrake@gmail.com Received: by 10.229.213.136 with HTTP; Sat, 7 Sep 2013 07:19:36 -0700 (PDT) In-Reply-To: <52292ED5.8040800@gnome.org> References: <52292ED5.8040800@gnome.org> Date: Sat, 7 Sep 2013 08:19:36 -0600 X-Google-Sender-Auth: YMkbOiGHAOhaLu8f1-qZWiqvnVs Message-ID: Subject: Re: Retrieve final URL after redirection From: Daniel Drake To: Dan Winship Content-Type: text/plain; charset=ISO-8859-1 Cc: libsoup-list@gnome.org X-BeenThere: libsoup-list@gnome.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "discussion of libsoup, an HTTP library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Sep 2013 14:19:54 -0000 On Thu, Sep 5, 2013 at 7:24 PM, Dan Winship wrote: > The SoupMessage's URI gets updated when a redirect happens, so just call > soup_message_get_uri() (or read the "uri" property), and then use that > with soup_uri_new_with_base() to resolve the relative link. from gi.repository import Soup I tried that, and it doesn't seem to work. session = Soup.SessionSync() uri = Soup.URI.new("http://www.google.com") m = Soup.Message(uri=uri) session.send_message(m) print m.get_uri().to_string(False) print m.get_property('uri').to_string(False) Output is http://www.google.com/ http://www.google.com/ but google definitely redirects. Tested with libsoup-2.42.2 Daniel From danw@gnome.org Sat Sep 7 15:37:36 2013 Return-Path: X-Original-To: libsoup-list@gnome.org Delivered-To: libsoup-list@gnome.org Received: from localhost (localhost.localdomain [127.0.0.1]) by restaurant.gnome.org (Postfix) with ESMTP id F24A07695A for ; Sat, 7 Sep 2013 15:37:35 +0000 (UTC) X-Virus-Scanned: by amavisd-new at gnome.org X-Spam-Flag: NO X-Spam-Score: -1.121 X-Spam-Level: X-Spam-Status: No, score=-1.121 tagged_above=-999 required=2 tests=[BAYES_00=-1.9, SPF_NEUTRAL=0.779] autolearn=no Received: from restaurant.gnome.org ([127.0.0.1]) by localhost (restaurant.gnome.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ptVe1NPJJVPE for ; Sat, 7 Sep 2013 15:37:21 +0000 (UTC) Received: from mysterion.org (mysterion.org [66.228.43.119]) by restaurant.gnome.org (Postfix) with ESMTP id 8005B76303 for ; Sat, 7 Sep 2013 15:37:10 +0000 (UTC) Message-ID: <522B4817.1010905@gnome.org> Date: Sat, 07 Sep 2013 11:36:55 -0400 From: Dan Winship User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8 MIME-Version: 1.0 To: Daniel Drake Subject: Re: Retrieve final URL after redirection References: <52292ED5.8040800@gnome.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: libsoup-list@gnome.org X-BeenThere: libsoup-list@gnome.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "discussion of libsoup, an HTTP library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Sep 2013 15:37:36 -0000 On 09/07/2013 10:19 AM, Daniel Drake wrote: > I tried that, and it doesn't seem to work. > > session = Soup.SessionSync() > uri = Soup.URI.new("http://www.google.com") > m = Soup.Message(uri=uri) > session.send_message(m) > print m.get_uri().to_string(False) > print m.get_property('uri').to_string(False) > > Output is > http://www.google.com/ > http://www.google.com/ > > but google definitely redirects. Tested with libsoup-2.42.2 I don't get a redirect when I fetch that URI. If I fetch "http://google.com/" with no "www", then it redirects to "www.google.com", and the URI property on the message gets updated to reflect that. -- Dan From dsdrake@gmail.com Sat Sep 7 15:41:36 2013 Return-Path: X-Original-To: libsoup-list@gnome.org Delivered-To: libsoup-list@gnome.org Received: from localhost (localhost.localdomain [127.0.0.1]) by restaurant.gnome.org (Postfix) with ESMTP id 87E117695A; Sat, 7 Sep 2013 15:41:36 +0000 (UTC) X-Virus-Scanned: by amavisd-new at gnome.org X-Spam-Flag: NO X-Spam-Score: -2.6 X-Spam-Level: X-Spam-Status: No, score=-2.6 tagged_above=-999 required=2 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=ham Received: from restaurant.gnome.org ([127.0.0.1]) by localhost (restaurant.gnome.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id umynVE9Xi--0; Sat, 7 Sep 2013 15:41:22 +0000 (UTC) Received: from mail-qa0-f41.google.com (mail-qa0-f41.google.com [209.85.216.41]) by restaurant.gnome.org (Postfix) with ESMTP id B7D8B76303; Sat, 7 Sep 2013 15:41:12 +0000 (UTC) Received: by mail-qa0-f41.google.com with SMTP id hu16so1071467qab.7 for ; Sat, 07 Sep 2013 08:41:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=R7umrdpWN8JFt9pOIc9mcIix0N+4tzELG3C/0Mus+ao=; b=SeZd5z714jQLpP1BKTsIpcvbnyGPR5O1F4Puyx8maBkIwNOgb5UxtIMH6VT5nFzHnU asOqoN+ZxVcG3OhT1JysmtfYd2xhPlfmSojI6Etk9GoKy1JE00Fzx8sEYSIOWA8hHgp2 UHzFlujqPnpX8uRoTNnfgJ8WUjP9paQ5MOaU9WOQaHopouNCc2+Mpoa5v5Vuwzucb5T3 nvdoXu022sbkHqNItsb1foBEYN2Bfn64384jQlqUZeO55d6qV9IaziQoqfcavJlxHpUe G9Tq9Q2Ol3sOF3Wtp53zAxCvNMTt8tK/4ZCenZmBtboUECF8mP7fon+4rYNdMch2TTVc lVCQ== MIME-Version: 1.0 X-Received: by 10.49.116.178 with SMTP id jx18mr1633288qeb.81.1378568470433; Sat, 07 Sep 2013 08:41:10 -0700 (PDT) Sender: dsdrake@gmail.com Received: by 10.229.213.136 with HTTP; Sat, 7 Sep 2013 08:41:10 -0700 (PDT) In-Reply-To: <522B4817.1010905@gnome.org> References: <52292ED5.8040800@gnome.org> <522B4817.1010905@gnome.org> Date: Sat, 7 Sep 2013 09:41:10 -0600 X-Google-Sender-Auth: JG-deDhJonXR8DvRCHnasPSCWHs Message-ID: Subject: Re: Retrieve final URL after redirection From: Daniel Drake To: Dan Winship Content-Type: text/plain; charset=ISO-8859-1 Cc: libsoup-list@gnome.org X-BeenThere: libsoup-list@gnome.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "discussion of libsoup, an HTTP library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Sep 2013 15:41:36 -0000 On Sat, Sep 7, 2013 at 9:36 AM, Dan Winship wrote: > I don't get a redirect when I fetch that URI. > > If I fetch "http://google.com/" with no "www", then it redirects to > "www.google.com", and the URI property on the message gets updated to > reflect that. Hmm. http://google.com/ definitely redirects here too, but the URI property does not change in my test case. Another test case is http://ftp.gnome.org/pub/GNOME/sources/libsoup This does redirect to http://ftp.gnome.org/pub/GNOME/sources/libsoup/ (trailing slash added). But in the same test, the URI property does not change. Anyway, good to know how this is supposed to work. I will dig into the code and see if I can find an explanation. Thanks Daniel From iker.perez@fon.com Mon Sep 9 11:11:18 2013 Return-Path: X-Original-To: libsoup-list@gnome.org Delivered-To: libsoup-list@gnome.org Received: from localhost (localhost.localdomain [127.0.0.1]) by restaurant.gnome.org (Postfix) with ESMTP id 1E42A76B2A for ; Mon, 9 Sep 2013 11:11:18 +0000 (UTC) X-Virus-Scanned: by amavisd-new at gnome.org X-Spam-Flag: NO X-Spam-Score: -2.599 X-Spam-Level: X-Spam-Status: No, score=-2.599 tagged_above=-999 required=2 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=ham Received: from restaurant.gnome.org ([127.0.0.1]) by localhost (restaurant.gnome.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9yssugp0ulRw for ; Mon, 9 Sep 2013 11:11:03 +0000 (UTC) Received: from mail-ie0-f177.google.com (mail-ie0-f177.google.com [209.85.223.177]) by restaurant.gnome.org (Postfix) with ESMTP id AFCF376B51 for ; Mon, 9 Sep 2013 11:10:52 +0000 (UTC) Received: by mail-ie0-f177.google.com with SMTP id qd12so2405424ieb.8 for ; Mon, 09 Sep 2013 04:10:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=K1fVhGf+3KnMVtCq8FOxt9vPJyPyauEbvWgBAi3Vkk4=; b=eSrfSEEVQAs0jZ6S6962UtoJslfHSy7AIlZdQxRHkSz5Q4e24VLtcFKzNTjuU/PCqS Pks3KV02nVY442MNwPEwduWfc5uJAmAsA+mzl9/uf/Ny7WWECnda/w3yosc14u1moRLk mp99qx04L341AQEjFXYjMcxkobv0BQtcTDtn5qBRCApi+iltdSih86ZqFnAmCoSRTj/Q 6dC32mzxG7DwM0TMJAQvI8aXbVOVUQvQYC1nbYXHEkZjv41Jc3ATvnkR+PScXoygXjeM amomwYV1XTpPAefevAohOhYkjRCImlyJ0+9d+QvymuUdVARcusJHk4t59yTo2Q26mNIn UqHA== X-Gm-Message-State: ALoCoQk0eNLhVWZir8W7QWLiBPofdeTWKDGruS76paeeDnaDLXKLR2OIttdmQBtCYRPpNPIvb8de MIME-Version: 1.0 X-Received: by 10.43.19.198 with SMTP id ql6mr3453555icb.22.1378725051309; Mon, 09 Sep 2013 04:10:51 -0700 (PDT) Received: by 10.42.252.198 with HTTP; Mon, 9 Sep 2013 04:10:51 -0700 (PDT) Date: Mon, 9 Sep 2013 13:10:51 +0200 Message-ID: Subject: SEGMENTATION FAULT on OWRT From: Iker Perez de Albeniz To: libsoup-list@gnome.org Content-Type: multipart/alternative; boundary=bcaec519694bed380104e5f170a9 X-BeenThere: libsoup-list@gnome.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "discussion of libsoup, an HTTP library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Sep 2013 11:11:18 -0000 --bcaec519694bed380104e5f170a9 Content-Type: text/plain; charset=ISO-8859-1 Hi All, This is my first message on the list. I have been searching for this error on internet but no luck so i have decided to post it on this list. I am running gstremer with mopidy on a MIPS router device with openwrt, sometimes i get a 404 error because of streaming source but the problem is that if i retry an other stream i get a segmentation fault. Could not open resource for reading. Debug message: gstsouphttpsrc.c(1099): gst_soup_http_src_parse_status (): /GstPlayBin2:playbin20/GstURIDecodeBin:uridecodebin5/GstSoupHTTPSrc:source: 404 Not Found I have seen that line on code: 1098 : : case SOUP_STATUS_MALFORMED: 1099 [ # # ][ # # ]: 0 : SOUP_HTTP_SRC_ERROR (src, msg, RESOURCE, READ, and it seems to be a malformed header problem or similar too.. but what i want to know is if it is a known fixed error.. the version of libraries are: Libsoup -- 2.28.2 glib2 -- 2.16.1 gst-plugins-good --0.10.23 Thanks and Regards. Iker --bcaec519694bed380104e5f170a9 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi All,

This is my first mes= sage on the list. I have been searching for this error on internet but no l= uck so i have decided to post it on this list.

I a= m running gstremer with mopidy on a MIPS router device with openwrt, someti= mes i get a 404 error because of streaming source but the problem is that i= f i retry an other stream i get a segmentation fault.

Could not open resource for reading. Debug message: gst= souphttpsrc.c(1099): gst_soup_http_src_parse_status (): /GstPlayBin2:playbi= n20/GstURIDecodeBin:uridecodebin5/GstSoupHTTPSrc:source:
404 Not = Found

I have seen that line on code:
 1098 =
                :            :       case SOUP_STATUS_MALFORMED:
    1099 [ #  # ][ #  # ]:          0 :         SOUP_HTTP_SRC_ER=
ROR (src, msg, RESOURCE, READ,

and it seems to be a malformed header = problem or similar too.. but what i want to know is if it is a known fixed = error.. the version of libraries are:

Libsoup -- 2= .28.2
glib2 =A0-- 2.16.1
gst-plugins-good --0.10.23

=
Thanks and Regards.
Iker

--bcaec519694bed380104e5f170a9-- From danw@gnome.org Mon Sep 9 13:02:43 2013 Return-Path: X-Original-To: libsoup-list@gnome.org Delivered-To: libsoup-list@gnome.org Received: from localhost (localhost.localdomain [127.0.0.1]) by restaurant.gnome.org (Postfix) with ESMTP id 6639976BA5 for ; Mon, 9 Sep 2013 13:02:43 +0000 (UTC) X-Virus-Scanned: by amavisd-new at gnome.org X-Spam-Flag: NO X-Spam-Score: -1.121 X-Spam-Level: X-Spam-Status: No, score=-1.121 tagged_above=-999 required=2 tests=[BAYES_00=-1.9, SPF_NEUTRAL=0.779] autolearn=no Received: from restaurant.gnome.org ([127.0.0.1]) by localhost (restaurant.gnome.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RpQQCwSwgM3b for ; Mon, 9 Sep 2013 13:02:29 +0000 (UTC) Received: from mysterion.org (mysterion.org [66.228.43.119]) by restaurant.gnome.org (Postfix) with ESMTP id 1038E76B1A for ; Mon, 9 Sep 2013 13:02:18 +0000 (UTC) Message-ID: <522DC6CB.9020502@gnome.org> Date: Mon, 09 Sep 2013 09:02:03 -0400 From: Dan Winship User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8 MIME-Version: 1.0 To: Iker Perez de Albeniz Subject: Re: SEGMENTATION FAULT on OWRT References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: libsoup-list@gnome.org X-BeenThere: libsoup-list@gnome.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "discussion of libsoup, an HTTP library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Sep 2013 13:02:43 -0000 On 09/09/2013 07:10 AM, Iker Perez de Albeniz wrote: > Could not open resource for reading. Debug message: > gstsouphttpsrc.c(1099): gst_soup_http_src_parse_status (): > /GstPlayBin2:playbin20/GstURIDecodeBin:uridecodebin5/GstSoupHTTPSrc:source: > 404 Not Found > and it seems to be a malformed header problem or similar too.. but what > i want to know is if it is a known fixed error.. the version of > libraries are: That's in gstreamer code, not libsoup, so you'd have to ask the gstreamer devels. -- Dan From iker.perez@fon.com Mon Sep 9 13:03:47 2013 Return-Path: X-Original-To: libsoup-list@gnome.org Delivered-To: libsoup-list@gnome.org Received: from localhost (localhost.localdomain [127.0.0.1]) by restaurant.gnome.org (Postfix) with ESMTP id 2112F76BA5 for ; Mon, 9 Sep 2013 13:03:47 +0000 (UTC) X-Virus-Scanned: by amavisd-new at gnome.org X-Spam-Flag: NO X-Spam-Score: -2.599 X-Spam-Level: X-Spam-Status: No, score=-2.599 tagged_above=-999 required=2 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=unavailable Received: from restaurant.gnome.org ([127.0.0.1]) by localhost (restaurant.gnome.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id X_9ttD7eODk3 for ; Mon, 9 Sep 2013 13:03:33 +0000 (UTC) Received: from mail-ie0-f174.google.com (mail-ie0-f174.google.com [209.85.223.174]) by restaurant.gnome.org (Postfix) with ESMTP id 98FF876B1A for ; Mon, 9 Sep 2013 13:03:23 +0000 (UTC) Received: by mail-ie0-f174.google.com with SMTP id k10so4325937iea.33 for ; Mon, 09 Sep 2013 06:03:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=1iadgKgO/HrkWN3ifcNmyxtpCx6QgkACJ+fDglzTWCg=; b=a3z7LbcreZWYbAfzbJCFThBT7CY1lR7eD6Ut9Udv0YvLdV4/IQnTCIfGmTj5y1bOqy BwgcECmNMDSGxMaCP4mQtYtmLv+A2OCCxo0Qb47fmKA7cx8qZkPYg+ivhNALXqvvzGu0 IS9vBuevfiHihUDdCrX7reuDWwAB6kzBw1Fk7ojB1sVpNPisE5PMEHwfr4fPJLygb2Lh dkKFlGRvPwUklGJ/twsM0CABhtcA6nwxqbs4Lz3BnegVXkbafikZtZ1kggqUTn1DHBCC v+4BKzsaWh8a3OxYxOIASWnwWhES2TcPptzFEjIdRREel04qKmnJE6bYFZHRW7hEkX3O dhlw== X-Gm-Message-State: ALoCoQlDPsncDF/rEAYlRPep5wGmXl7iHwlwm9vy59Z1zrnkHIZzdXmIRztkv0HNXhZHQ8Q7dzJ7 MIME-Version: 1.0 X-Received: by 10.50.13.8 with SMTP id d8mr7890071igc.46.1378731801850; Mon, 09 Sep 2013 06:03:21 -0700 (PDT) Received: by 10.42.252.198 with HTTP; Mon, 9 Sep 2013 06:03:21 -0700 (PDT) In-Reply-To: <522DC6CB.9020502@gnome.org> References: <522DC6CB.9020502@gnome.org> Date: Mon, 9 Sep 2013 15:03:21 +0200 Message-ID: Subject: Re: SEGMENTATION FAULT on OWRT From: Iker Perez de Albeniz To: Dan Winship Content-Type: multipart/alternative; boundary=089e013c66da4a550904e5f3038f Cc: libsoup-list@gnome.org X-BeenThere: libsoup-list@gnome.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "discussion of libsoup, an HTTP library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Sep 2013 13:03:47 -0000 --089e013c66da4a550904e5f3038f Content-Type: text/plain; charset=ISO-8859-1 I'll do... sorry Thanks! 2013/9/9 Dan Winship > On 09/09/2013 07:10 AM, Iker Perez de Albeniz wrote: > > Could not open resource for reading. Debug message: > > gstsouphttpsrc.c(1099): gst_soup_http_src_parse_status (): > > > /GstPlayBin2:playbin20/GstURIDecodeBin:uridecodebin5/GstSoupHTTPSrc:source: > > 404 Not Found > > > and it seems to be a malformed header problem or similar too.. but what > > i want to know is if it is a known fixed error.. the version of > > libraries are: > > That's in gstreamer code, not libsoup, so you'd have to ask the > gstreamer devels. > > -- Dan > > -- Iker Perez de Albeniz Senior R&D Engineer / Technical Lead Fon Labs skype: iker.perez.fon --089e013c66da4a550904e5f3038f Content-Type: text/html; charset=ISO-8859-1
I'll do... sorry

Thanks!


2013/9/9 Dan Winship <danw@gnome.org>
On 09/09/2013 07:10 AM, Iker Perez de Albeniz wrote:
> Could not open resource for reading. Debug message:
> gstsouphttpsrc.c(1099): gst_soup_http_src_parse_status ():
> /GstPlayBin2:playbin20/GstURIDecodeBin:uridecodebin5/GstSoupHTTPSrc:source:
> 404 Not Found

> and it seems to be a malformed header problem or similar too.. but what
> i want to know is if it is a known fixed error.. the version of
> libraries are:

That's in gstreamer code, not libsoup, so you'd have to ask the
gstreamer devels.

-- Dan




--

Iker Perez de Albeniz
Senior R&D Engineer / Technical Lead
Fon Labs
skype: iker.perez.fon
--089e013c66da4a550904e5f3038f-- From joseph.artsimovich@gmail.com Tue Sep 10 14:23:14 2013 Return-Path: X-Original-To: libsoup-list@gnome.org Delivered-To: libsoup-list@gnome.org Received: from localhost (localhost.localdomain [127.0.0.1]) by restaurant.gnome.org (Postfix) with ESMTP id 09E1576D47 for ; Tue, 10 Sep 2013 14:23:14 +0000 (UTC) X-Virus-Scanned: by amavisd-new at gnome.org X-Spam-Flag: NO X-Spam-Score: -2.6 X-Spam-Level: X-Spam-Status: No, score=-2.6 tagged_above=-999 required=2 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=ham Received: from restaurant.gnome.org ([127.0.0.1]) by localhost (restaurant.gnome.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1V-1D3nogm8a for ; Tue, 10 Sep 2013 14:22:59 +0000 (UTC) Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com [209.85.212.175]) by restaurant.gnome.org (Postfix) with ESMTP id CF29F76CD0 for ; Tue, 10 Sep 2013 14:22:46 +0000 (UTC) Received: by mail-wi0-f175.google.com with SMTP id ez12so769706wid.2 for ; Tue, 10 Sep 2013 07:22:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type; bh=ee8YzsFtRhqtxRq12+uy5Rf8X6J/fNLXGae/wzlwbrY=; b=oyfiYb/+ZSVtMmK7Ocx14yX6mXJ4pYcxnzMbeJP0OO43oV1WICapIFrh3I5PH/8VtV seMp3ivMs1myfboFVTx68RLMKnhBLrr8AiCdiubxNIWSBdFAvkeubgmHXICRjF8mYLEi uU8GyDWIbPGNfCb3qSMLZMvTSyqT2N5w2SjEvxTOrHuL7dkBi68GupYgdJb2A2N1gWAA 6f0Z1xSg+KW0tyIuSuuz5ftEWjnNScCyq50uAvpCmG+lBfaeApXUe/s5UbaJgJcvOeMp na/HMH89MVsa/BvF4cqXuHR5ccQB9tqNjv5YxfsihIZ54Enocw46GlFFZ0itIt3PnlIQ MYHA== X-Received: by 10.180.10.136 with SMTP id i8mr13148032wib.46.1378822965295; Tue, 10 Sep 2013 07:22:45 -0700 (PDT) Received: from [192.168.19.124] ([31.221.37.8]) by mx.google.com with ESMTPSA id e5sm3872305wiy.2.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 10 Sep 2013 07:22:44 -0700 (PDT) Sender: Joseph Artsimovich Message-ID: <522F2B21.8000207@youview.com> Date: Tue, 10 Sep 2013 15:22:25 +0100 From: Joseph Artsimovich User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130807 Thunderbird/17.0.8 MIME-Version: 1.0 To: libsoup-list@gnome.org Subject: Re: [PATCH] Support systemd socket activation mechanism References: <521635A6.3080201@youview.com> <52167754.6090308@gnome.org> <52177C69.5050507@youview.com> In-Reply-To: <52177C69.5050507@youview.com> Content-Type: multipart/mixed; boundary="------------080101090407020103040803" X-BeenThere: libsoup-list@gnome.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "discussion of libsoup, an HTTP library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Sep 2013 14:23:14 -0000 This is a multi-part message in MIME format. --------------080101090407020103040803 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi, Can anyone please review the latest version of my patch? The client code now looks like this: int fd = take_socket_from_systemd(); GSocket* sock = g_socket_new_from_fd(fd, NULL); SoupServer* server = soup_server_new(SOUP_SERVER_LISTEN_SOCKET, sock, NULL); g_object_unref(sock); -- Joseph Artsimovich Software Engineer at YouView TV Ltd --------------080101090407020103040803 Content-Type: text/plain; charset=ISO-8859-1; name="0001-Make-it-possible-to-provide-a-custom-listening-socke.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Make-it-possible-to-provide-a-custom-listening-socke.pa"; filename*1="tch" >From 19133797a3e1530e58a8c9e25b5c664a1d1ba197 Mon Sep 17 00:00:00 2001 From: Joseph Artsimovich Date: Thu, 22 Aug 2013 16:13:46 +0100 Subject: [PATCH] Make it possible to provide a custom listening socket to SoupServer To be used like this: sock = g_socket_new(...); g_socket_bind(sock, ...); g_socket_listen(sock, ...); soup_server_new(SOUP_SERVER_LISTEN_SOCKET, sock, NULL); This will make it possible to use systemd socket activation with libsoup. --- libsoup/soup-server.c | 27 ++++++++ libsoup/soup-server.h | 1 + libsoup/soup-socket.c | 101 ++++++++++++++++++++++--------- libsoup/soup-socket.h | 1 + tests/Makefile.am | 1 + tests/listen-socket-test.c | 142 ++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 244 insertions(+), 29 deletions(-) create mode 100644 tests/listen-socket-test.c diff --git a/libsoup/soup-server.c b/libsoup/soup-server.c index ff51e5b..9713a5b 100644 --- a/libsoup/soup-server.c +++ b/libsoup/soup-server.c @@ -96,6 +96,7 @@ typedef struct { GMainLoop *loop; SoupSocket *listen_sock; + GSocket *listen_sock_prop; GSList *clients; gboolean raw_paths; @@ -121,6 +122,7 @@ enum { PROP_ASYNC_CONTEXT, PROP_RAW_PATHS, PROP_SERVER_HEADER, + PROP_LISTEN_SOCKET, LAST_PROP }; @@ -158,6 +160,7 @@ soup_server_finalize (GObject *object) g_free (priv->server_header); g_clear_object (&priv->listen_sock); + g_clear_object (&priv->listen_sock_prop); while (priv->clients) { SoupClientContext *client = priv->clients->data; @@ -233,6 +236,7 @@ soup_server_constructor (GType type, soup_socket_new (SOUP_SOCKET_LOCAL_ADDRESS, priv->iface, SOUP_SOCKET_SSL_CREDENTIALS, priv->ssl_cert, SOUP_SOCKET_ASYNC_CONTEXT, priv->async_context, + SOUP_SOCKET_LISTEN_SOCKET, priv->listen_sock_prop, NULL); if (!soup_socket_listen (priv->listen_sock)) { g_object_unref (server); @@ -304,6 +308,9 @@ soup_server_set_property (GObject *object, guint prop_id, } else priv->server_header = g_strdup (header); break; + case PROP_LISTEN_SOCKET: + priv->listen_sock_prop = g_value_dup_object (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -628,6 +635,26 @@ soup_server_class_init (SoupServerClass *server_class) "Server header", NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + + /** + * SOUP_SERVER_LISTEN_SOCKET: + * + * Alias for the #SoupServer:listen-socket property. Makes it possible + * to provide a socket to be used for listening for incoming connections. + * The provided socket has to be in listening state already. Passing a + * null pointer as a value of this property is allowed and has no effect. + * When #SoupServer:listen-socket property is set, #SoupServer:interface + * and #SoupServer:port are ignored. + * + * Since: 2.44 + **/ + g_object_class_install_property ( + object_class, PROP_LISTEN_SOCKET, + g_param_spec_object (SOUP_SERVER_LISTEN_SOCKET, + "Listening socket", + "Socket in listening state", + G_TYPE_SOCKET, + G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); } /** diff --git a/libsoup/soup-server.h b/libsoup/soup-server.h index e1c9bbf..e4f7330 100644 --- a/libsoup/soup-server.h +++ b/libsoup/soup-server.h @@ -64,6 +64,7 @@ typedef void (*SoupServerCallback) (SoupServer *server, #define SOUP_SERVER_ASYNC_CONTEXT "async-context" #define SOUP_SERVER_RAW_PATHS "raw-paths" #define SOUP_SERVER_SERVER_HEADER "server-header" +#define SOUP_SERVER_LISTEN_SOCKET "listen-socket" SoupServer *soup_server_new (const char *optname1, ...) G_GNUC_NULL_TERMINATED; diff --git a/libsoup/soup-socket.c b/libsoup/soup-socket.c index baa9290..1959ac6 100644 --- a/libsoup/soup-socket.c +++ b/libsoup/soup-socket.c @@ -60,6 +60,7 @@ enum { PROP_TLS_CERTIFICATE, PROP_TLS_ERRORS, PROP_PROXY_RESOLVER, + PROP_LISTEN_SOCKET, LAST_PROP }; @@ -68,6 +69,7 @@ typedef struct { SoupAddress *local_addr, *remote_addr; GIOStream *conn, *iostream; GSocket *gsock; + GSocket *listen_sock; GInputStream *istream; GOutputStream *ostream; GTlsCertificateFlags tls_errors; @@ -142,6 +144,8 @@ soup_socket_finalize (GObject *object) disconnect_internal (SOUP_SOCKET (object), TRUE); } + g_clear_object (&priv->listen_sock); + g_clear_object (&priv->conn); g_clear_object (&priv->iostream); g_clear_object (&priv->istream); @@ -228,6 +232,9 @@ soup_socket_set_property (GObject *object, guint prop_id, case PROP_CLEAN_DISPOSE: priv->clean_dispose = g_value_get_boolean (value); break; + case PROP_LISTEN_SOCKET: + priv->listen_sock = g_value_dup_object (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -627,6 +634,26 @@ soup_socket_class_init (SoupSocketClass *socket_class) "GProxyResolver to use", G_TYPE_PROXY_RESOLVER, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + + /** + * SOUP_SOCKET_LISTEN_SOCKET: + * + * Alias for the #SoupSocket:listen-socket property. Makes it possible + * to provide a socket to be used for listening for incoming connections. + * The provided socket has to be in listening state already. Passing a + * null pointer as a value of this property is allowed and has no effect. + * When #SoupSocket:listen-socket property is set, #SoupSocket:local-address + * is ignored. + * + * Since: 2.44 + **/ + g_object_class_install_property ( + object_class, PROP_LISTEN_SOCKET, + g_param_spec_object (SOUP_SOCKET_LISTEN_SOCKET, + "Listening socket", + "Socket in listening state", + G_TYPE_SOCKET, + G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); } @@ -955,8 +982,12 @@ listen_watch (GObject *pollable, gpointer data) * @sock: a server #SoupSocket (which must not already be connected or * listening) * - * Makes @sock start listening on its local address. When connections - * come in, @sock will emit #SoupSocket::new_connection. + * Makes @sock start listening on its local address, or whatever address + * #SoupSocket::listen-socket is bound to, if it was provided. + * Note than even though #SoupSocket::listen-socket must already be + * in listening state, a call to soup_socket_listen() is still required. + * + * When connections come in, @sock will emit #SoupSocket::new_connection. * * Return value: whether or not @sock is now listening. **/ @@ -970,42 +1001,54 @@ soup_socket_listen (SoupSocket *sock) g_return_val_if_fail (SOUP_IS_SOCKET (sock), FALSE); priv = SOUP_SOCKET_GET_PRIVATE (sock); g_return_val_if_fail (priv->gsock == NULL, FALSE); - g_return_val_if_fail (priv->local_addr != NULL, FALSE); + if (!priv->listen_sock) + g_return_val_if_fail (priv->local_addr != NULL, FALSE); priv->is_server = TRUE; - /* @local_addr may have its port set to 0. So we intentionally - * don't store it in priv->local_addr, so that if the - * caller calls soup_socket_get_local_address() later, we'll - * have to make a new addr by calling getsockname(), which - * will have the right port number. - */ - addr = soup_address_get_gsockaddr (priv->local_addr); - g_return_val_if_fail (addr != NULL, FALSE); + if (priv->listen_sock) { + priv->gsock = priv->listen_sock; + g_object_ref(priv->gsock); + finish_socket_setup (priv); + } else { + /* @local_addr may have its port set to 0. So we intentionally + * don't store it in priv->local_addr, so that if the + * caller calls soup_socket_get_local_address() later, we'll + * have to make a new addr by calling getsockname(), which + * will have the right port number. + */ + addr = soup_address_get_gsockaddr (priv->local_addr); + g_return_val_if_fail (addr != NULL, FALSE); - priv->gsock = g_socket_new (g_socket_address_get_family (addr), - G_SOCKET_TYPE_STREAM, - G_SOCKET_PROTOCOL_DEFAULT, - NULL); - if (!priv->gsock) - goto cant_listen; - finish_socket_setup (priv); + priv->gsock = g_socket_new (g_socket_address_get_family (addr), + G_SOCKET_TYPE_STREAM, + G_SOCKET_PROTOCOL_DEFAULT, + NULL); - /* Bind */ - if (!g_socket_bind (priv->gsock, addr, TRUE, NULL)) - goto cant_listen; - /* Force local_addr to be re-resolved now */ - g_object_unref (priv->local_addr); - priv->local_addr = NULL; + if (!priv->gsock) + goto cant_listen; + finish_socket_setup (priv); - /* Listen */ - if (!g_socket_listen (priv->gsock, NULL)) - goto cant_listen; + /* Bind */ + if (!g_socket_bind (priv->gsock, addr, TRUE, NULL)) + goto cant_listen; + + /* Listen */ + if (!g_socket_listen (priv->gsock, NULL)) + goto cant_listen; + + g_object_unref (addr); + } + + /* Force local_addr to be re-resolved now */ + if (priv->local_addr) { + g_object_unref (priv->local_addr); + priv->local_addr = NULL; + } priv->watch_src = soup_socket_create_watch (priv, G_IO_IN, listen_watch, sock, NULL); - g_object_unref (addr); return TRUE; cant_listen: diff --git a/libsoup/soup-socket.h b/libsoup/soup-socket.h index 5c1264f..a2a90dd 100644 --- a/libsoup/soup-socket.h +++ b/libsoup/soup-socket.h @@ -52,6 +52,7 @@ typedef struct { #define SOUP_SOCKET_TIMEOUT "timeout" #define SOUP_SOCKET_TLS_CERTIFICATE "tls-certificate" #define SOUP_SOCKET_TLS_ERRORS "tls-errors" +#define SOUP_SOCKET_LISTEN_SOCKET "listen-socket" typedef void (*SoupSocketCallback) (SoupSocket *sock, guint status, diff --git a/tests/Makefile.am b/tests/Makefile.am index 22c4a85..5aed8ef 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -20,6 +20,7 @@ TESTS = \ date \ forms-test \ header-parsing \ + listen-socket-test \ misc-test \ multipart-test \ no-ssl-test \ diff --git a/tests/listen-socket-test.c b/tests/listen-socket-test.c new file mode 100644 index 0000000..0c424b3 --- /dev/null +++ b/tests/listen-socket-test.c @@ -0,0 +1,142 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Copyright 2013 YouView TV Ltd + */ + +#include "test-utils.h" + +#include +#include + +static GSocket* create_listening_socket (void) +{ + gboolean bret; + GSocket* sock; + GInetAddress* inet_addr; + GSocketAddress* sock_addr; + + inet_addr = g_inet_address_new_loopback(G_SOCKET_FAMILY_IPV4); + sock_addr = g_inet_socket_address_new(inet_addr, 0); + + + sock = g_socket_new (G_SOCKET_FAMILY_IPV4, G_SOCKET_TYPE_STREAM, + G_SOCKET_PROTOCOL_TCP, NULL); + g_assert(sock); + + bret = g_socket_bind (sock, sock_addr, /*allow_reuse*/TRUE, NULL); + g_assert(bret); + + bret = g_socket_listen (sock, NULL); + g_assert(bret); + + g_object_unref(sock_addr); + g_object_unref(inet_addr); + + return sock; +} + +static void +do_listen_socket_low_level_test (void) +{ + GSocket* listen_sock; + SoupSocket* server_sock, *client_sock; + SoupAddress* server_addr; + gboolean bret; + guint uret; + + listen_sock = create_listening_socket (); + g_assert(listen_sock); + + server_sock = soup_socket_new (SOUP_SOCKET_LISTEN_SOCKET, listen_sock, NULL); + g_assert (server_sock); + + bret = soup_socket_listen (server_sock); + g_assert (bret); + + server_addr = soup_socket_get_local_address (server_sock); + g_assert (server_addr); + g_assert (g_socket_get_fd (listen_sock) == soup_socket_get_fd (server_sock)); + + client_sock = soup_socket_new (SOUP_SOCKET_REMOTE_ADDRESS, server_addr, NULL); + g_assert (client_sock); + + uret = soup_socket_connect_sync (client_sock, NULL); + g_assert_cmpuint (uret, ==, SOUP_STATUS_OK); + + g_object_unref (client_sock); + g_object_unref (server_sock); + g_object_unref (listen_sock); +} + +struct RequestContext +{ + GMainLoop* main_loop; + guint response_status; +}; + +static void +response_handler(SoupSession *session, SoupMessage *msg, gpointer user_data) +{ + struct RequestContext* ctx = user_data; + ctx->response_status = msg->status_code; + g_main_loop_quit (ctx->main_loop); +} + +static void +do_listen_socket_server_test (void) +{ + GSocket* listen_sock; + SoupServer* server; + SoupSocket* server_listener; + SoupSession* session; + SoupMessage* message; + char http_addr[100]; + guint server_port; + struct RequestContext ctx; + + ctx.main_loop = g_main_loop_new (NULL, FALSE); + ctx.response_status = 0; + g_assert (ctx.main_loop); + + listen_sock = create_listening_socket (); + g_assert (listen_sock); + + server = soup_server_new (SOUP_SERVER_LISTEN_SOCKET, listen_sock, NULL); + g_assert (server); + server_port = soup_server_get_port (server); + + server_listener = soup_server_get_listener (server); + g_assert(server_listener); + g_assert (g_socket_get_fd (listen_sock) == soup_socket_get_fd (server_listener)); + + session = soup_session_async_new (); + g_assert (session); + + g_snprintf (http_addr, sizeof(http_addr), "http://127.0.0.1:%u/", server_port); + message = soup_message_new ("GET", http_addr); + + soup_session_queue_message (session, message, &response_handler, &ctx); + + soup_server_run_async (server); + + g_main_loop_run (ctx.main_loop); + + g_object_unref (session); + g_object_unref (server); + g_object_unref (listen_sock); + g_main_loop_unref (ctx.main_loop); + + g_assert_cmpuint (ctx.response_status, ==, SOUP_STATUS_NOT_FOUND); +} + +int +main (int argc, char **argv) +{ + test_init (argc, argv, NULL); + + do_listen_socket_low_level_test (); + do_listen_socket_server_test (); + + test_cleanup (); + return errors != 0; +} -- 1.7.1 --------------080101090407020103040803-- From iiordanov@gmail.com Sun Sep 15 06:05:44 2013 Return-Path: X-Original-To: libsoup-list@gnome.org Delivered-To: libsoup-list@gnome.org Received: from localhost (localhost.localdomain [127.0.0.1]) by restaurant.gnome.org (Postfix) with ESMTP id 7463D76967 for ; Sun, 15 Sep 2013 06:05:44 +0000 (UTC) X-Virus-Scanned: by amavisd-new at gnome.org X-Spam-Flag: NO X-Spam-Score: -2.7 X-Spam-Level: X-Spam-Status: No, score=-2.7 tagged_above=-999 required=2 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=ham Received: from restaurant.gnome.org ([127.0.0.1]) by localhost (restaurant.gnome.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ox7DsyWrTCsl for ; Sun, 15 Sep 2013 06:05:39 +0000 (UTC) Received: from mail-qc0-f179.google.com (mail-qc0-f179.google.com [209.85.216.179]) by restaurant.gnome.org (Postfix) with ESMTP id 6F45D76574 for ; Sun, 15 Sep 2013 06:05:28 +0000 (UTC) Received: by mail-qc0-f179.google.com with SMTP id l4so2063450qcv.10 for ; Sat, 14 Sep 2013 23:05:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=kdcZ5+RwrjJtg9NnvdrpkbsKJylKAdf2lXKE21hTsGQ=; b=QsnoQrdztBAov+M5gizFZRYCK3Q/frAHP6jE7ugEIHZ0qVOgCjkC4LAh6RPwQpZIb6 jw8Hu0fAEF0mWVd5hZM9Ko2c8XJpO1g8gvyu0r3cyaxw5gr01sCSjZ1lqlcAod9ae7nf 8v8zmX3VZUEkffz7XecdTglo/t+Dteg6ONJVniFBoeUUlE5Phybrn8M59Ya2CwkVSZaU WwdCFVqK4NBBBClL3AV7dChP9tz62UkNww2SsZCtEBPUxaFIqncogc1phHbz3GF/i203 wMTWH8acZ7LTIVKto25PslmiWdYX49KZ70Z9HFPWUD3A88d09t2hyTOnneXR2qJ76V6N JMIA== MIME-Version: 1.0 X-Received: by 10.49.132.233 with SMTP id ox9mr39427470qeb.36.1379225127094; Sat, 14 Sep 2013 23:05:27 -0700 (PDT) Received: by 10.140.33.80 with HTTP; Sat, 14 Sep 2013 23:05:27 -0700 (PDT) Date: Sun, 15 Sep 2013 02:05:27 -0400 Message-ID: Subject: TLS/SSL support not available on Android even with glib-networking installed From: i iordanov To: libsoup-list@gnome.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: libsoup-list@gnome.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "discussion of libsoup, an HTTP library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Sep 2013 06:05:44 -0000 Hello everyone, I am trying to get libsoup with TLS/SSL in order to add oVirt support to my GPL project aSPICE (SPICE client for Android). I've built all the necessary libraries including libsoup 2.40.3. I currently build and link libsoup statically into my project, and I've also built glib-networking and all its dependencies as shared libraries, and load them at run-time with Android's System.loadLibrary(). The shared libraries I'm loading in order to try giving libsoup TLS/SSL support are: System.loadLibrary("iconv"); System.loadLibrary("intl"); System.loadLibrary("p11-kit"); System.loadLibrary("nettle"); System.loadLibrary("gnutls"); System.loadLibrary("giognutls"); And yet, whenever govirt (the library which handles oVirt support) uses libsoup, it returns an error with the contents: TLS/SSL support not available; install glib-networking Even though to my understanding, glib-networking is as "installed" as I can make it on Android. Do you have any suggestions about what I'm missing, or what I can try in order to get this to run? Many thanks in advance! iordan iordanov -- The conscious mind has only one thread of execution. From danw@gnome.org Sun Sep 15 18:58:40 2013 Return-Path: X-Original-To: libsoup-list@gnome.org Delivered-To: libsoup-list@gnome.org Received: from localhost (localhost.localdomain [127.0.0.1]) by restaurant.gnome.org (Postfix) with ESMTP id 3ED8E76A3C for ; Sun, 15 Sep 2013 18:58:40 +0000 (UTC) X-Virus-Scanned: by amavisd-new at gnome.org X-Spam-Flag: NO X-Spam-Score: -1.121 X-Spam-Level: X-Spam-Status: No, score=-1.121 tagged_above=-999 required=2 tests=[BAYES_00=-1.9, SPF_NEUTRAL=0.779] autolearn=no Received: from restaurant.gnome.org ([127.0.0.1]) by localhost (restaurant.gnome.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UO7T82v5-Aon for ; Sun, 15 Sep 2013 18:58:25 +0000 (UTC) Received: from mysterion.org (mysterion.org [66.228.43.119]) by restaurant.gnome.org (Postfix) with ESMTP id B81BF76A5A for ; Sun, 15 Sep 2013 18:58:14 +0000 (UTC) Message-ID: <52360333.1050708@gnome.org> Date: Sun, 15 Sep 2013 14:57:55 -0400 From: Dan Winship User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8 MIME-Version: 1.0 To: i iordanov Subject: Re: TLS/SSL support not available on Android even with glib-networking installed References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: libsoup-list@gnome.org X-BeenThere: libsoup-list@gnome.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "discussion of libsoup, an HTTP library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Sep 2013 18:58:40 -0000 On 09/15/2013 02:05 AM, i iordanov wrote: > System.loadLibrary("giognutls"); > > And yet, whenever govirt (the library which handles oVirt support) > uses libsoup, it returns an error with the contents: > > TLS/SSL support not available; install glib-networking > > Even though to my understanding, glib-networking is as "installed" as > I can make it on Android. Right. gio needs to be told about each module that's available in order to be able to use them. Normally gio handles this itself when it dlopens the module, but since you're bypassing that, the module never gets registered. If you don't have working gmodule support and can't let gio load the gnutls module on its own, then you'll have to hack up glib-networking a bit; change gtlsbackend-gnutls.c to use G_DEFINE_TYPE_EXTENDED (and G_IMPLEMENT_INTERFACE) at the top, rather than the _DYNAMIC versions of each, remove the g_type_plugin_use() call in gtls_gnutls_init(), and remove the GIOModule argument and g_tls_backend_gnutls_register_type() call from g_tls_backend_gnutls_register(). (And remove gnutls-module.c entirely.) Then you need to call g_tls_backend_gnutls_register() from main() or something, but you have to call it *after* _g_io_modules_ensure_loaded() is called. That function isn't currently visible outside of glib, so there's no way for you to call it directly. You could patch glib to make it be exported, but the easier hack is to just request some *other* extension point. Eg, call g_vfs_get_default() or g_proxy_resolver_get_default(), and just ignore the result, and then call g_tls_backend_gnutls_register(). -- Dan From iiordanov@gmail.com Sun Sep 15 19:34:41 2013 Return-Path: X-Original-To: libsoup-list@gnome.org Delivered-To: libsoup-list@gnome.org Received: from localhost (localhost.localdomain [127.0.0.1]) by restaurant.gnome.org (Postfix) with ESMTP id 6844D76A3C; Sun, 15 Sep 2013 19:34:41 +0000 (UTC) X-Virus-Scanned: by amavisd-new at gnome.org X-Spam-Flag: NO X-Spam-Score: -2.7 X-Spam-Level: X-Spam-Status: No, score=-2.7 tagged_above=-999 required=2 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=ham Received: from restaurant.gnome.org ([127.0.0.1]) by localhost (restaurant.gnome.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tmZ0jsVHlEDe; Sun, 15 Sep 2013 19:34:37 +0000 (UTC) Received: from mail-qe0-f47.google.com (mail-qe0-f47.google.com [209.85.128.47]) by restaurant.gnome.org (Postfix) with ESMTP id C8E3076947; Sun, 15 Sep 2013 19:34:26 +0000 (UTC) Received: by mail-qe0-f47.google.com with SMTP id b4so2295412qen.20 for ; Sun, 15 Sep 2013 12:34:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=QHCcjsM8OX9Z4p4bkEm4jki0xPO5IH4wS2PUFQPSYw0=; b=lkXaQfwcqwD5ZxaF4Ic2PrccwB6rCTwDvR0Ezywz/vwq992Hrxh0v+9RJjTPRd8+SB FWBcThvH9jYVAc3KleBX2UgvwS+qgp9BeTYOsecllIZw9oIifbuD5VA2oNvAHG1aybRo PkPeI3ADaBYxeSRVaz+2ksvSpt7vC6iMrSOYaRL1s/Y/cSBSy76bRolvDQ2Fps8Jwwj8 zmYEs52MmWHmhmd7z/jUUp1985xIUTdKMfkZ2EIKp7Qizda4aGttGZTi0e0kRazvBAEe UrzAwEfxwPdGF3aY3lhTaRqCJ0vOx9eE2i3q2GAySK+0BGvYCEnKvmASBUuArXUno/GH iwog== MIME-Version: 1.0 X-Received: by 10.224.3.1 with SMTP id 1mr3853384qal.85.1379273664415; Sun, 15 Sep 2013 12:34:24 -0700 (PDT) Received: by 10.140.88.241 with HTTP; Sun, 15 Sep 2013 12:34:24 -0700 (PDT) In-Reply-To: <52360333.1050708@gnome.org> References: <52360333.1050708@gnome.org> Date: Sun, 15 Sep 2013 15:34:24 -0400 Message-ID: Subject: Re: TLS/SSL support not available on Android even with glib-networking installed From: i iordanov To: Dan Winship Content-Type: text/plain; charset=ISO-8859-1 Cc: libsoup-list@gnome.org X-BeenThere: libsoup-list@gnome.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "discussion of libsoup, an HTTP library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Sep 2013 19:34:41 -0000 Hi Dan, Thanks for the excellent advice. I will try what you're suggesting as soon as possible. I hope you don't mind if I have questions to ask. As an alternative, how do you suppose I can enable automatic discovery of modules by GIO on Android? So far, I've tried changing the GIO_MODULE_DIR when I build glib to be /sdcard/gio (just as a test, of course), and I've placed the libgiognutls.so module in /sdcard/gio on the device. This doesn't seem to work, however. Since you seem well versed in the order of operations involved in discovering the module, could you help me understand what other conditions I need to prepare for the module discovery to work? Many thanks! iordan On Sun, Sep 15, 2013 at 2:57 PM, Dan Winship wrote: > On 09/15/2013 02:05 AM, i iordanov wrote: >> System.loadLibrary("giognutls"); >> >> And yet, whenever govirt (the library which handles oVirt support) >> uses libsoup, it returns an error with the contents: >> >> TLS/SSL support not available; install glib-networking >> >> Even though to my understanding, glib-networking is as "installed" as >> I can make it on Android. > > Right. gio needs to be told about each module that's available in order > to be able to use them. Normally gio handles this itself when it dlopens > the module, but since you're bypassing that, the module never gets > registered. > > If you don't have working gmodule support and can't let gio load the > gnutls module on its own, then you'll have to hack up glib-networking a > bit; change gtlsbackend-gnutls.c to use G_DEFINE_TYPE_EXTENDED (and > G_IMPLEMENT_INTERFACE) at the top, rather than the _DYNAMIC versions of > each, remove the g_type_plugin_use() call in gtls_gnutls_init(), and > remove the GIOModule argument and g_tls_backend_gnutls_register_type() > call from g_tls_backend_gnutls_register(). (And remove gnutls-module.c > entirely.) > > Then you need to call g_tls_backend_gnutls_register() from main() or > something, but you have to call it *after* _g_io_modules_ensure_loaded() > is called. That function isn't currently visible outside of glib, so > there's no way for you to call it directly. You could patch glib to make > it be exported, but the easier hack is to just request some *other* > extension point. Eg, call g_vfs_get_default() or > g_proxy_resolver_get_default(), and just ignore the result, and then > call g_tls_backend_gnutls_register(). > > -- Dan > -- The conscious mind has only one thread of execution. From iiordanov@gmail.com Sun Sep 15 22:52:19 2013 Return-Path: X-Original-To: libsoup-list@gnome.org Delivered-To: libsoup-list@gnome.org Received: from localhost (localhost.localdomain [127.0.0.1]) by restaurant.gnome.org (Postfix) with ESMTP id D125676A45; Sun, 15 Sep 2013 22:52:19 +0000 (UTC) X-Virus-Scanned: by amavisd-new at gnome.org X-Spam-Flag: NO X-Spam-Score: -2.7 X-Spam-Level: X-Spam-Status: No, score=-2.7 tagged_above=-999 required=2 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=ham Received: from restaurant.gnome.org ([127.0.0.1]) by localhost (restaurant.gnome.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZbfnUWnE5nPW; Sun, 15 Sep 2013 22:52:15 +0000 (UTC) Received: from mail-qc0-f182.google.com (mail-qc0-f182.google.com [209.85.216.182]) by restaurant.gnome.org (Postfix) with ESMTP id 8A8F376A4C; Sun, 15 Sep 2013 22:52:15 +0000 (UTC) Received: by mail-qc0-f182.google.com with SMTP id n4so2369236qcx.27 for ; Sun, 15 Sep 2013 15:52:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=jEIRcSlQP/ozqVGw7w+I0LHFHzii0mk2dXyKTeaTV5c=; b=h1JRwKHXHtDzjlwJCr+gK/nY7ylj45fkhJfhy4QIcnRUMmQ9qcgqiTPsiKaXj+upZ5 w67n4Cu/LbN2vzyZ/xUkUsmifjSaEYoTanadQ3L+E8Xzr5Wef93XHcHCi88+MqJkIiam 4blTEBXKCKJN/CF78IfuJS2A5sWxwLztqOnFW+BI40Kx3H3rwCl5swI+sdlzIDArlyWU g/O6sY9z6kBdqRnFuj/wYfG2z7KtUZ1jQpG6U5UmRKjFHTrx2qu6W77d0l08PFWcih+V w0Q+KbJ0uzrITJ3DjsHl9Mm3WLiJe4MJ7r/V/nUI6MptW32Ya7QzI7YShupy8uo9RZSX 0x2A== MIME-Version: 1.0 X-Received: by 10.224.134.197 with SMTP id k5mr10582337qat.74.1379285534044; Sun, 15 Sep 2013 15:52:14 -0700 (PDT) Received: by 10.140.88.241 with HTTP; Sun, 15 Sep 2013 15:52:13 -0700 (PDT) In-Reply-To: References: <52360333.1050708@gnome.org> Date: Sun, 15 Sep 2013 18:52:13 -0400 Message-ID: Subject: Re: TLS/SSL support not available on Android even with glib-networking installed From: i iordanov To: Dan Winship Content-Type: text/plain; charset=ISO-8859-1 Cc: libsoup-list@gnome.org X-BeenThere: libsoup-list@gnome.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "discussion of libsoup, an HTTP library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Sep 2013 22:52:19 -0000 Hi Dan, My apologies, my experiment hadn't worked because I hadn't done something else (use rpl to remove versions from required libraries) on the particular libgiognutls.so file which I used for the experiment. My problem appears solved if I am able to provide an acceptable GIO_MODULE_DIR to glib. On a side note, can GIO_MODULE_DIR contain more than one directory separated with colons, or just one? Thanks! iordan On Sun, Sep 15, 2013 at 3:34 PM, i iordanov wrote: > Hi Dan, > > Thanks for the excellent advice. I will try what you're suggesting as > soon as possible. I hope you don't mind if I have questions to ask. > > As an alternative, how do you suppose I can enable automatic discovery > of modules by GIO on Android? So far, I've tried changing the > GIO_MODULE_DIR when I build glib to be /sdcard/gio (just as a test, of > course), and I've placed the libgiognutls.so module in /sdcard/gio on > the device. This doesn't seem to work, however. Since you seem well > versed in the order of operations involved in discovering the module, > could you help me understand what other conditions I need to prepare > for the module discovery to work? > > Many thanks! > iordan > > On Sun, Sep 15, 2013 at 2:57 PM, Dan Winship wrote: >> On 09/15/2013 02:05 AM, i iordanov wrote: >>> System.loadLibrary("giognutls"); >>> >>> And yet, whenever govirt (the library which handles oVirt support) >>> uses libsoup, it returns an error with the contents: >>> >>> TLS/SSL support not available; install glib-networking >>> >>> Even though to my understanding, glib-networking is as "installed" as >>> I can make it on Android. >> >> Right. gio needs to be told about each module that's available in order >> to be able to use them. Normally gio handles this itself when it dlopens >> the module, but since you're bypassing that, the module never gets >> registered. >> >> If you don't have working gmodule support and can't let gio load the >> gnutls module on its own, then you'll have to hack up glib-networking a >> bit; change gtlsbackend-gnutls.c to use G_DEFINE_TYPE_EXTENDED (and >> G_IMPLEMENT_INTERFACE) at the top, rather than the _DYNAMIC versions of >> each, remove the g_type_plugin_use() call in gtls_gnutls_init(), and >> remove the GIOModule argument and g_tls_backend_gnutls_register_type() >> call from g_tls_backend_gnutls_register(). (And remove gnutls-module.c >> entirely.) >> >> Then you need to call g_tls_backend_gnutls_register() from main() or >> something, but you have to call it *after* _g_io_modules_ensure_loaded() >> is called. That function isn't currently visible outside of glib, so >> there's no way for you to call it directly. You could patch glib to make >> it be exported, but the easier hack is to just request some *other* >> extension point. Eg, call g_vfs_get_default() or >> g_proxy_resolver_get_default(), and just ignore the result, and then >> call g_tls_backend_gnutls_register(). >> >> -- Dan >> > > > > -- > The conscious mind has only one thread of execution. -- The conscious mind has only one thread of execution. From danw@gnome.org Mon Sep 16 12:54:23 2013 Return-Path: X-Original-To: libsoup-list@gnome.org Delivered-To: libsoup-list@gnome.org Received: from localhost (localhost.localdomain [127.0.0.1]) by restaurant.gnome.org (Postfix) with ESMTP id D6A6B760A7 for ; Mon, 16 Sep 2013 12:54:23 +0000 (UTC) X-Virus-Scanned: by amavisd-new at gnome.org X-Spam-Flag: NO X-Spam-Score: -1.121 X-Spam-Level: X-Spam-Status: No, score=-1.121 tagged_above=-999 required=2 tests=[BAYES_00=-1.9, SPF_NEUTRAL=0.779] autolearn=no Received: from restaurant.gnome.org ([127.0.0.1]) by localhost (restaurant.gnome.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MRfXGpdFgMjz for ; Mon, 16 Sep 2013 12:54:09 +0000 (UTC) Received: from mysterion.org (mysterion.org [66.228.43.119]) by restaurant.gnome.org (Postfix) with ESMTP id 6467076CE4 for ; Mon, 16 Sep 2013 12:53:57 +0000 (UTC) Message-ID: <5236FF53.9090108@gnome.org> Date: Mon, 16 Sep 2013 08:53:39 -0400 From: Dan Winship User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8 MIME-Version: 1.0 To: i iordanov Subject: Re: TLS/SSL support not available on Android even with glib-networking installed References: <52360333.1050708@gnome.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: libsoup-list@gnome.org X-BeenThere: libsoup-list@gnome.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "discussion of libsoup, an HTTP library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Sep 2013 12:54:23 -0000 On 09/15/2013 06:52 PM, i iordanov wrote: > Hi Dan, > > My apologies, my experiment hadn't worked because I hadn't done > something else (use rpl to remove versions from required libraries) on > the particular libgiognutls.so file which I used for the experiment. > > My problem appears solved if I am able to provide an acceptable > GIO_MODULE_DIR to glib. > > On a side note, can GIO_MODULE_DIR contain more than one directory > separated with colons, or just one? GIO_MODULE_DIR is just a single directly, but you can set the GIO_EXTRA_MODULES environment variable to a colon-separated list of paths at runtime, and it will search in each of those directories. -- Dan From bill@pecknet.com Mon Sep 23 15:27:15 2013 Return-Path: X-Original-To: libsoup-list@gnome.org Delivered-To: libsoup-list@gnome.org Received: from localhost (localhost.localdomain [127.0.0.1]) by restaurant.gnome.org (Postfix) with ESMTP id DE515769DA for ; Mon, 23 Sep 2013 15:27:15 +0000 (UTC) X-Virus-Scanned: by amavisd-new at gnome.org X-Spam-Flag: NO X-Spam-Score: -2.599 X-Spam-Level: X-Spam-Status: No, score=-2.599 tagged_above=-999 required=2 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=ham Received: from restaurant.gnome.org ([127.0.0.1]) by localhost (restaurant.gnome.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id z72zen3NUxaG for ; Mon, 23 Sep 2013 15:27:10 +0000 (UTC) Received: from mail-ee0-f41.google.com (mail-ee0-f41.google.com [74.125.83.41]) by restaurant.gnome.org (Postfix) with ESMTP id 02D4B769D7 for ; Mon, 23 Sep 2013 15:26:58 +0000 (UTC) Received: by mail-ee0-f41.google.com with SMTP id d17so1848130eek.28 for ; Mon, 23 Sep 2013 08:26:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=yP5ko3HrAN4JL1orEdWKIYRuUVlC4WkowDarAXVZ8Cc=; b=USYSHHmBIhoq26NfreWuZIAFf8gSFLF5l9SVGOtDpXVHkyVfbK5N3T1eW6/4F5jx7L 7FAcanrmSkYBE4Zbpl+ptIVbfH9kU+IpP/yHOKmBON+afvIrcqUBYlpO75+TGxc6zzBa Jdi9bINCC1+Us2xOGYN7aAeKSB7msfDnd+5EJrTBlUguYFUGCCu40fkBME1M3qmUubeC +rx+mSa0w4ynaj4Elk0qL2GTyTxF1XMFMSBrBPOZubPBobWxGOpNdQzV7JIzxHyKX+PY anQbI/yMrhD6xCm+UXi2GSZFIVvQ3eYwMor5CO+3+Dp207/UpS+KWcxTSQWtlxXggBda +UOg== X-Gm-Message-State: ALoCoQl+ztsyuN1KIACdz486qpoF3tbbVvGN20NVGv2awSlYmIKL43HZ3AsSLDiC3gT10oju96vg MIME-Version: 1.0 X-Received: by 10.15.54.199 with SMTP id t47mr5269136eew.46.1379950016112; Mon, 23 Sep 2013 08:26:56 -0700 (PDT) Received: by 10.14.110.71 with HTTP; Mon, 23 Sep 2013 08:26:56 -0700 (PDT) Date: Mon, 23 Sep 2013 11:26:56 -0400 Message-ID: Subject: got_chunk signal From: Bill Peck To: libsoup-list@gnome.org Content-Type: multipart/alternative; boundary=001a11c3d4b084ffaa04e70ea60f X-BeenThere: libsoup-list@gnome.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "discussion of libsoup, an HTTP library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Sep 2013 15:27:16 -0000 --001a11c3d4b084ffaa04e70ea60f Content-Type: text/plain; charset=ISO-8859-1 I have a question about the got_chunk signal. I know the docs mention that it's not guaranteed to match the chunks the sender sent, but is there a way to fix that? I'm sending chunks from the server side prepended with a 1 byte char that represents where to send the output to (stdout or stderr) but as you might have guessed I sometimes have a chunk from the server broken into two parts by the receiver. tcpdump confirms that I am getting it as one message from the server so I don't understand why libsoup sometimes (not always) breaks it into multiple chunks. --001a11c3d4b084ffaa04e70ea60f Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

I have a question about the got_chunk signal. =A0= I know the docs mention that it's not guaranteed to match the chunks th= e sender sent, but is there a way to fix that?

I&#= 39;m sending chunks from the server side prepended with a 1 byte char that = represents where to send the output to (stdout or stderr) but as you might = have guessed I sometimes have a chunk from the server broken into two parts= by the receiver. =A0 tcpdump confirms that I am getting it as one message = from the server so I don't understand why libsoup sometimes (not always= ) breaks it into multiple chunks.


--001a11c3d4b084ffaa04e70ea60f-- From danw@gnome.org Mon Sep 23 17:27:48 2013 Return-Path: X-Original-To: libsoup-list@gnome.org Delivered-To: libsoup-list@gnome.org Received: from localhost (localhost.localdomain [127.0.0.1]) by restaurant.gnome.org (Postfix) with ESMTP id EEE0E76D3E for ; Mon, 23 Sep 2013 17:27:48 +0000 (UTC) X-Virus-Scanned: by amavisd-new at gnome.org X-Spam-Flag: NO X-Spam-Score: -1.121 X-Spam-Level: X-Spam-Status: No, score=-1.121 tagged_above=-999 required=2 tests=[BAYES_00=-1.9, SPF_NEUTRAL=0.779] autolearn=no Received: from restaurant.gnome.org ([127.0.0.1]) by localhost (restaurant.gnome.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Dl-0-pMRWqdG for ; Mon, 23 Sep 2013 17:27:43 +0000 (UTC) Received: from mysterion.org (mysterion.org [66.228.43.119]) by restaurant.gnome.org (Postfix) with ESMTP id 6A40176B3A for ; Mon, 23 Sep 2013 17:27:32 +0000 (UTC) Message-ID: <524079F4.10007@gnome.org> Date: Mon, 23 Sep 2013 13:27:16 -0400 From: Dan Winship User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: Bill Peck , libsoup-list@gnome.org Subject: Re: got_chunk signal References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-BeenThere: libsoup-list@gnome.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "discussion of libsoup, an HTTP library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Sep 2013 17:27:49 -0000 On 09/23/2013 11:26 AM, Bill Peck wrote: > > I have a question about the got_chunk signal. I know the docs mention > that it's not guaranteed to match the chunks the sender sent, but is > there a way to fix that? > > I'm sending chunks from the server side prepended with a 1 byte char > that represents where to send the output to (stdout or stderr) but as > you might have guessed I sometimes have a chunk from the server broken > into two parts by the receiver. tcpdump confirms that I am getting it > as one message from the server so I don't understand why libsoup > sometimes (not always) breaks it into multiple chunks. There's no way to make libsoup guarantee that it will emit the same chunks that the server sends, but your protocol shouldn't depend on being able to do that anyway; if the user is using a proxy, then the proxy might re-chunkify the data as well. Chunking isn't part of the response, it's just an aspect of how the response is transferred from server to client. One supported (and semi-standard) way to do what you want is to send a response body of type multipart/x-mixed-replace, and have each response be a new body part. On the client side you can then use SoupMultipartInputStream to split up the response into the right pieces. (There's example code of this somewhere in the WebKit sources...) -- Dan From bill@pecknet.com Mon Sep 23 19:40:19 2013 Return-Path: X-Original-To: libsoup-list@gnome.org Delivered-To: libsoup-list@gnome.org Received: from localhost (localhost.localdomain [127.0.0.1]) by restaurant.gnome.org (Postfix) with ESMTP id 64EA576C26 for ; Mon, 23 Sep 2013 19:40:19 +0000 (UTC) X-Virus-Scanned: by amavisd-new at gnome.org X-Spam-Flag: NO X-Spam-Score: -2.599 X-Spam-Level: X-Spam-Status: No, score=-2.599 tagged_above=-999 required=2 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=ham Received: from restaurant.gnome.org ([127.0.0.1]) by localhost (restaurant.gnome.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZO32Op8W7Xpi for ; Mon, 23 Sep 2013 19:40:14 +0000 (UTC) Received: from mail-ee0-f47.google.com (mail-ee0-f47.google.com [74.125.83.47]) by restaurant.gnome.org (Postfix) with ESMTP id 2896676D41 for ; Mon, 23 Sep 2013 19:40:01 +0000 (UTC) Received: by mail-ee0-f47.google.com with SMTP id d49so1992040eek.34 for ; Mon, 23 Sep 2013 12:39:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=AynxugaKzI0kcE0DivGZ9eVJLEcbYsbnVLkBWviL2oA=; b=c/geYohAjFiYMfkQnW+gD55v47w9dw6e6TV68gTbCg3L41f4erQ+m/FVlryJEuzN05 ra9iG1X4hpdBMtDh1cRZHQHk36lqmURoJniXSA3D1l5ZVb7jRsC7cT2UZCGAwSywLNJj 6GRl5RC21vSvZB7qgEYQlKx0fyk7m4URlH9WUBmjq73sPo4pPc8cmgSEne1zH0s7IXO0 bjz9GDExGL6HfF3F0aTv0MvKReyQfOPR9EMqSwRWLdEhozcKyIAnenQtlRloWF8OnIET iMGyCym+HG+Z7x85QPJjYP6MoUBZQ7JzF+7RJEL++fxRVX2jt8JatFaXr9y3WwHvrQY1 gA5A== X-Gm-Message-State: ALoCoQnCd+YLz1AseSrivG2H0o/p/KkU1NI0/wFPxseaaR4VpHHL/mf34ub5l8NASe5VGK3no+sm MIME-Version: 1.0 X-Received: by 10.14.219.198 with SMTP id m46mr7748418eep.41.1379965199276; Mon, 23 Sep 2013 12:39:59 -0700 (PDT) Received: by 10.14.110.71 with HTTP; Mon, 23 Sep 2013 12:39:59 -0700 (PDT) In-Reply-To: <524079F4.10007@gnome.org> References: <524079F4.10007@gnome.org> Date: Mon, 23 Sep 2013 15:39:59 -0400 Message-ID: Subject: Re: got_chunk signal From: Bill Peck To: Dan Winship Content-Type: multipart/alternative; boundary=047d7b60399c818ecf04e7122f4b Cc: libsoup-list@gnome.org X-BeenThere: libsoup-list@gnome.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "discussion of libsoup, an HTTP library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Sep 2013 19:40:19 -0000 --047d7b60399c818ecf04e7122f4b Content-Type: text/plain; charset=ISO-8859-1 Hi Dan, Thanks for the suggestion. I'm currently trying to clone the webkit repo to look for the example you mention. I also looked at tests/multipart-test.c which shows several payloads separated by the boundary --cut-here\r\n. Would this keep the connection open to my clients like it currently does? I would be able to keep calling soup_message_body_append () as I read in data? Thanks On Mon, Sep 23, 2013 at 1:27 PM, Dan Winship wrote: > On 09/23/2013 11:26 AM, Bill Peck wrote: > > > > I have a question about the got_chunk signal. I know the docs mention > > that it's not guaranteed to match the chunks the sender sent, but is > > there a way to fix that? > > > > I'm sending chunks from the server side prepended with a 1 byte char > > that represents where to send the output to (stdout or stderr) but as > > you might have guessed I sometimes have a chunk from the server broken > > into two parts by the receiver. tcpdump confirms that I am getting it > > as one message from the server so I don't understand why libsoup > > sometimes (not always) breaks it into multiple chunks. > > There's no way to make libsoup guarantee that it will emit the same > chunks that the server sends, but your protocol shouldn't depend on > being able to do that anyway; if the user is using a proxy, then the > proxy might re-chunkify the data as well. Chunking isn't part of the > response, it's just an aspect of how the response is transferred from > server to client. > > One supported (and semi-standard) way to do what you want is to send a > response body of type multipart/x-mixed-replace, and have each response > be a new body part. On the client side you can then use > SoupMultipartInputStream to split up the response into the right pieces. > (There's example code of this somewhere in the WebKit sources...) > > -- Dan > > --047d7b60399c818ecf04e7122f4b Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

Hi Dan,

Thanks for the s= uggestion. =A0I'm currently trying to clone the webkit repo to look for= the example you mention. =A0I also looked at tests/multipart-test.c which = shows several payloads separated by the boundary --cut-here\r\n. =A0Would t= his keep the connection open to my clients like it currently does? =A0I wou= ld be able to keep calling=A0soup_message_body_append () as I read in data?=

Thanks



On Mon, Sep 23, 2013 at 1:27 PM, Da= n Winship <danw@gnome.org> wrote:
On 0= 9/23/2013 11:26 AM, Bill Peck wrote:
>
> I have a question about the got_chunk signal. =A0I know the docs menti= on
> that it's not guaranteed to match the chunks the sender sent, but = is
> there a way to fix that?
>
> I'm sending chunks from the server side prepended with a 1 byte ch= ar
> that represents where to send the output to (stdout or stderr) but as<= br> > you might have guessed I sometimes have a chunk from the server broken=
> into two parts by the receiver. =A0 tcpdump confirms that I am getting= it
> as one message from the server so I don't understand why libsoup > sometimes (not always) breaks it into multiple chunks.

There's no way to make libsoup guarantee that it will emit = the same
chunks that the server sends, but your protocol shouldn't depend on
being able to do that anyway; if the user is using a proxy, then the
proxy might re-chunkify the data as well. Chunking isn't part of the response, it's just an aspect of how the response is transferred from server to client.

One supported (and semi-standard) way to do what you want is to send a
response body of type multipart/x-mixed-replace, and have each response
be a new body part. On the client side you can then use
SoupMultipartInputStream to split up the response into the right pieces. (There's example code of this somewhere in the WebKit sources...)

-- Dan


--047d7b60399c818ecf04e7122f4b-- From danw@gnome.org Tue Sep 24 14:52:26 2013 Return-Path: X-Original-To: libsoup-list@gnome.org Delivered-To: libsoup-list@gnome.org Received: from localhost (localhost.localdomain [127.0.0.1]) by restaurant.gnome.org (Postfix) with ESMTP id 1E32176B98 for ; Tue, 24 Sep 2013 14:52:26 +0000 (UTC) X-Virus-Scanned: by amavisd-new at gnome.org X-Spam-Flag: NO X-Spam-Score: -1.121 X-Spam-Level: X-Spam-Status: No, score=-1.121 tagged_above=-999 required=2 tests=[BAYES_00=-1.9, SPF_NEUTRAL=0.779] autolearn=no Received: from restaurant.gnome.org ([127.0.0.1]) by localhost (restaurant.gnome.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Zgl3ezreDx4R for ; Tue, 24 Sep 2013 14:52:21 +0000 (UTC) Received: from mysterion.org (mysterion.org [66.228.43.119]) by restaurant.gnome.org (Postfix) with ESMTP id 2DB8676B75 for ; Tue, 24 Sep 2013 14:52:10 +0000 (UTC) Message-ID: <5241A70E.9060302@gnome.org> Date: Tue, 24 Sep 2013 10:51:58 -0400 From: Dan Winship User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: Bill Peck Subject: Re: got_chunk signal References: <524079F4.10007@gnome.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: libsoup-list@gnome.org X-BeenThere: libsoup-list@gnome.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "discussion of libsoup, an HTTP library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Sep 2013 14:52:26 -0000 On 09/23/2013 03:39 PM, Bill Peck wrote: > > Hi Dan, > > Thanks for the suggestion. I'm currently trying to clone the webkit > repo to look for the example you mention. I also looked at > tests/multipart-test.c which shows several payloads separated by the > boundary --cut-here\r\n. Would this keep the connection open to my > clients like it currently does? I would be able to keep > calling soup_message_body_append () as I read in data? Yes. If you're using chunked encoding, SoupServer won't close the connection until you call soup_message_body_complete(), so if you never call that, it will never close the connection. (Although since you no longer care about chunks, it probably makes more sense to switch to SOUP_ENCODING_EOF, which also will let you keep streaming until you call soup_message_body_complete().) -- Dan From bill@pecknet.com Tue Sep 24 15:59:12 2013 Return-Path: X-Original-To: libsoup-list@gnome.org Delivered-To: libsoup-list@gnome.org Received: from localhost (localhost.localdomain [127.0.0.1]) by restaurant.gnome.org (Postfix) with ESMTP id 3E94976CFA for ; Tue, 24 Sep 2013 15:59:12 +0000 (UTC) X-Virus-Scanned: by amavisd-new at gnome.org X-Spam-Flag: NO X-Spam-Score: -2.599 X-Spam-Level: X-Spam-Status: No, score=-2.599 tagged_above=-999 required=2 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=unavailable Received: from restaurant.gnome.org ([127.0.0.1]) by localhost (restaurant.gnome.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wQ1vqWL75IEs for ; Tue, 24 Sep 2013 15:59:07 +0000 (UTC) Received: from mail-ea0-f171.google.com (mail-ea0-f171.google.com [209.85.215.171]) by restaurant.gnome.org (Postfix) with ESMTP id 51E1576D96 for ; Tue, 24 Sep 2013 15:58:56 +0000 (UTC) Received: by mail-ea0-f171.google.com with SMTP id n15so2589973ead.16 for ; Tue, 24 Sep 2013 08:58:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=j4tpGQGLwxIhhFDIf5lwRs8iYYoL8eFm5gDAGLCWWqk=; b=EBNdUzuM8meIq7/Azr0SukYrC7F+BfjPTAC5kVE9q6TpsAgkndOUoQsYjLXIds2Do7 zSqEo4vIiushdh1STb7w/jlYTT8qq4r5/+McL+FVB0RgLP1q4p8biMoUHT15EBSgWWYn OZcI4nG1o9Qz6fk2qFsGYxY0Rf9g0TIbUyjhHC5Nl+Zx84pEDmPz1t9EVsnwHf97qLvp oP1+Au6DZF0muu5u0ScvRUsFE3wpWyN0fluKgwr03lVvtT4wcEJCelJtkZZOTzM3a+Ix SasEpDtKJqSwHDdBr6rp9Um2+Is5wXlMAKSnJbaggMS8D2Fh+5NJ54pVv3cnmG+Be9Vt Kedw== X-Gm-Message-State: ALoCoQmHVj4BnYY3TScTpaIqebSYhBMq+PkQp4wlnVHDq5+qbcxK/G4c9fsb/OIf7JCtT5rteG4J MIME-Version: 1.0 X-Received: by 10.15.35.67 with SMTP id f43mr142738eev.100.1380038334677; Tue, 24 Sep 2013 08:58:54 -0700 (PDT) Received: by 10.14.110.71 with HTTP; Tue, 24 Sep 2013 08:58:54 -0700 (PDT) In-Reply-To: <5241A70E.9060302@gnome.org> References: <524079F4.10007@gnome.org> <5241A70E.9060302@gnome.org> Date: Tue, 24 Sep 2013 11:58:54 -0400 Message-ID: Subject: Re: got_chunk signal From: Bill Peck To: Dan Winship Content-Type: multipart/alternative; boundary=089e016354eab7422d04e72336b5 Cc: libsoup-list@gnome.org X-BeenThere: libsoup-list@gnome.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "discussion of libsoup, an HTTP library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Sep 2013 15:59:12 -0000 --089e016354eab7422d04e72336b5 Content-Type: text/plain; charset=ISO-8859-1 Hi Dan, I'm getting closer but I'm stuck because I'm trying to use soup_session_send_async instead of soup_request_send_async. Correct me if I'm wrong but it looks like soup_request_* is the old way to do things and SoupSession is the cleaner approach? Where I'm getting stuck is in my call back: static void multipart_handling_cb (GObject *source, GAsyncResult *async_result, gpointer data) { GMainLoop *loop = (GmainLoop *) data; SoupSession *session = SOUP_SESSION (source); GError *error = NULL; GInputStream *in; SoupMessage *message; in = soup_session_send_finish (session, async_result, &error); message = // How do I get message from session? multipart = soup_multipart_input_stream)new (message, in); . . . } I'm not sure how to get SoupMessage from SoupSession. Am I pointed in the right direction? Sorry if these are silly questions. On Tue, Sep 24, 2013 at 10:51 AM, Dan Winship wrote: > On 09/23/2013 03:39 PM, Bill Peck wrote: > > > > Hi Dan, > > > > Thanks for the suggestion. I'm currently trying to clone the webkit > > repo to look for the example you mention. I also looked at > > tests/multipart-test.c which shows several payloads separated by the > > boundary --cut-here\r\n. Would this keep the connection open to my > > clients like it currently does? I would be able to keep > > calling soup_message_body_append () as I read in data? > > Yes. If you're using chunked encoding, SoupServer won't close the > connection until you call soup_message_body_complete(), so if you never > call that, it will never close the connection. (Although since you no > longer care about chunks, it probably makes more sense to switch to > SOUP_ENCODING_EOF, which also will let you keep streaming until you call > soup_message_body_complete().) > > -- Dan > > --089e016354eab7422d04e72336b5 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

Hi Dan,

I'm getting = closer but I'm stuck because I'm trying to use soup_session_send_as= ync instead of soup_request_send_async. =A0Correct me if I'm wrong but = it looks like soup_request_* is the old way to do things and SoupSession is= the cleaner approach?

Where I'm getting stuck is in my call back:

static void
multipart_handling_cb (GObject *sou= rce, GAsyncResult *async_result, gpointer data)
{
=A0 =A0 GMainLoop *loop =3D (GmainLoop *) data;
=A0 =A0 SoupSessi= on *session =3D SOUP_SESSION (source);
=A0 =A0 GError *error =3D = NULL;
=A0 =A0 GInputStream *in;
=A0 =A0 SoupMessage *me= ssage;

=A0 =A0 in =3D soup_session_send_finish (session, async_result, &e= rror);
=A0 =A0 message =3D // How do I get message from session?= =A0
=A0 =A0 multipart =3D soup_multipart_input_stream)new (= message, in);
=A0 =A0.
=A0 =A0.
=A0 =A0.
}
<= br>
I'm not sure how to get SoupMessage from SoupSession.=A0<= /div>

Am I pointed in the right direction? =A0Sorry if t= hese are silly questions. =A0


On Tue,= Sep 24, 2013 at 10:51 AM, Dan Winship <danw@gnome.org> wrote:<= br>
On 09/23/2013 03:39 PM, Bill Peck wrote:
>
> Hi Dan,
>
> Thanks for the suggestion. =A0I'm currently trying to clone the we= bkit
> repo to look for the example you mention. =A0I also looked at
> tests/multipart-test.c which shows several payloads separated by the > boundary --cut-here\r\n. =A0Would this keep the connection open to my<= br> > clients like it currently does? =A0I would be able to keep
> calling soup_message_body_append () as I read in data?

Yes. If you're using chunked encoding, SoupServer won't close= the
connection until you call soup_message_body_complete(), so if you never
call that, it will never close the connection. (Although since you no
longer care about chunks, it probably makes more sense to switch to
SOUP_ENCODING_EOF, which also will let you keep streaming until you call soup_message_body_complete().)

-- Dan


--089e016354eab7422d04e72336b5-- From bill@pecknet.com Tue Sep 24 17:43:06 2013 Return-Path: X-Original-To: libsoup-list@gnome.org Delivered-To: libsoup-list@gnome.org Received: from localhost (localhost.localdomain [127.0.0.1]) by restaurant.gnome.org (Postfix) with ESMTP id 56B7576CCE for ; Tue, 24 Sep 2013 17:43:06 +0000 (UTC) X-Virus-Scanned: by amavisd-new at gnome.org X-Spam-Flag: NO X-Spam-Score: -2.599 X-Spam-Level: X-Spam-Status: No, score=-2.599 tagged_above=-999 required=2 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=ham Received: from restaurant.gnome.org ([127.0.0.1]) by localhost (restaurant.gnome.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5bKxUu4sjiPE for ; Tue, 24 Sep 2013 17:43:02 +0000 (UTC) Received: from mail-ea0-f173.google.com (mail-ea0-f173.google.com [209.85.215.173]) by restaurant.gnome.org (Postfix) with ESMTP id 3660D76DC7 for ; Tue, 24 Sep 2013 17:42:51 +0000 (UTC) Received: by mail-ea0-f173.google.com with SMTP id g10so2643682eak.18 for ; Tue, 24 Sep 2013 10:42:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=Q9QZTECLzr0pyz8maPjw1sSjLWhuhd3spbU1nwDPPjk=; b=JUbvqswcfkkjAJ+FdouYKsk6FkCEe6zKc0mBn0hNuGBVCcdlcaXktk1A8TmO8w4x/E qozywBDLpxvcM6UOgJc0/L2d+alSg0tfCz9qQfTVsenmt71umK/M77bEuuGp1H0Jm3Ze 6vnsYQyIO4gCAAcVq5ZmEkWRibeedS8Y0YsywiqwFVacIqte4/I6aCqM8/tRGmy0N5HV 0JMQuWBq5+z/OdCrw7YBy5BmV4DoORzHtG5B7TVp4CiI249YJLufcN1qX9CrWspaEh8l bW1ha0NdPsqdJEuay+KjKexpUmEwj77vio4BknRJCZmK8GpUSjmReiqjkbUhKl/2KQiR 5hrA== X-Gm-Message-State: ALoCoQk/KBQRHMIBA4/KO+FiEmrkX2fVOwUQJSOfa5xm2vbpozrg3h8EDkUI7YmFOwRq6RKo0hRL MIME-Version: 1.0 X-Received: by 10.14.183.130 with SMTP id q2mr48452163eem.5.1380044569614; Tue, 24 Sep 2013 10:42:49 -0700 (PDT) Received: by 10.14.110.71 with HTTP; Tue, 24 Sep 2013 10:42:49 -0700 (PDT) In-Reply-To: References: <524079F4.10007@gnome.org> <5241A70E.9060302@gnome.org> Date: Tue, 24 Sep 2013 13:42:49 -0400 Message-ID: Subject: Re: got_chunk signal From: Bill Peck To: Dan Winship Content-Type: multipart/alternative; boundary=047d7b34429e58d28e04e724aa7f Cc: libsoup-list@gnome.org X-BeenThere: libsoup-list@gnome.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "discussion of libsoup, an HTTP library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Sep 2013 17:43:06 -0000 --047d7b34429e58d28e04e724aa7f Content-Type: text/plain; charset=ISO-8859-1 So unless you say otherwise it looks like creating a request is the right way to go here. I ended up creating a SoupRequest and pulling msg out of it to set my form variables. Thanks for the help. I have it working now. :-) On Tue, Sep 24, 2013 at 11:58 AM, Bill Peck wrote: > > Hi Dan, > > I'm getting closer but I'm stuck because I'm trying to use > soup_session_send_async instead of soup_request_send_async. Correct me if > I'm wrong but it looks like soup_request_* is the old way to do things and > SoupSession is the cleaner approach? > > Where I'm getting stuck is in my call back: > > static void > multipart_handling_cb (GObject *source, GAsyncResult *async_result, > gpointer data) > { > GMainLoop *loop = (GmainLoop *) data; > SoupSession *session = SOUP_SESSION (source); > GError *error = NULL; > GInputStream *in; > SoupMessage *message; > > in = soup_session_send_finish (session, async_result, &error); > message = // How do I get message from session? > multipart = soup_multipart_input_stream)new (message, in); > . > . > . > } > > I'm not sure how to get SoupMessage from SoupSession. > > Am I pointed in the right direction? Sorry if these are silly questions. > > > On Tue, Sep 24, 2013 at 10:51 AM, Dan Winship wrote: > >> On 09/23/2013 03:39 PM, Bill Peck wrote: >> > >> > Hi Dan, >> > >> > Thanks for the suggestion. I'm currently trying to clone the webkit >> > repo to look for the example you mention. I also looked at >> > tests/multipart-test.c which shows several payloads separated by the >> > boundary --cut-here\r\n. Would this keep the connection open to my >> > clients like it currently does? I would be able to keep >> > calling soup_message_body_append () as I read in data? >> >> Yes. If you're using chunked encoding, SoupServer won't close the >> connection until you call soup_message_body_complete(), so if you never >> call that, it will never close the connection. (Although since you no >> longer care about chunks, it probably makes more sense to switch to >> SOUP_ENCODING_EOF, which also will let you keep streaming until you call >> soup_message_body_complete().) >> >> -- Dan >> >> > --047d7b34429e58d28e04e724aa7f Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

So unless you say otherwise it looks like creatin= g a request is the right way to go here. =A0I ended up creating a SoupReque= st and pulling msg out of it to set my form variables.

=
Thanks for the help. =A0I have it working now. :-)=A0

<= /div>


On Tue, = Sep 24, 2013 at 11:58 AM, Bill Peck <bill@pecknet.com> wrote:=

Hi Dan,
=
I'm getting closer but I'm stuck because I'm try= ing to use soup_session_send_async instead of soup_request_send_async. =A0C= orrect me if I'm wrong but it looks like soup_request_* is the old way = to do things and SoupSession is the cleaner approach?

Where I'm getting stuck is in my call back:

static void
multipart_handling_cb (GObject *sou= rce, GAsyncResult *async_result, gpointer data)
{
=A0 =A0 GMainLoop *loop =3D (GmainLoop *) data;
=A0 =A0 SoupSessi= on *session =3D SOUP_SESSION (source);
=A0 =A0 GError *error =3D = NULL;
=A0 =A0 GInputStream *in;
=A0 =A0 SoupMessage *me= ssage;

=A0 =A0 in =3D soup_session_send_finish (session, async_result, &e= rror);
=A0 =A0 message =3D // How do I get message from session?= =A0
=A0 =A0 multipart =3D soup_multipart_input_stream)new (= message, in);
=A0 =A0.
=A0 =A0.
=A0 =A0.
}
<= br>
I'm not sure how to get SoupMessage from SoupSession.=A0<= /div>

Am I pointed in the right direction? =A0Sorry if t= hese are silly questions. =A0

On Tue, Sep 24, 2013 at 10:51 AM, Dan Wins= hip <danw@gnome.org> wrote:
On 09/23/2013 03:39 PM, Bill Peck wrote:
>
> Hi Dan,
>
> Thanks for the suggestion. =A0I'm currently trying to clone the we= bkit
> repo to look for the example you mention. =A0I also looked at
> tests/multipart-test.c which shows several payloads separated by the > boundary --cut-here\r\n. =A0Would this keep the connection open to my<= br> > clients like it currently does? =A0I would be able to keep
> calling soup_message_body_append () as I read in data?

Yes. If you're using chunked encoding, SoupServer won't close= the
connection until you call soup_message_body_complete(), so if you never
call that, it will never close the connection. (Although since you no
longer care about chunks, it probably makes more sense to switch to
SOUP_ENCODING_EOF, which also will let you keep streaming until you call soup_message_body_complete().)

-- Dan



--047d7b34429e58d28e04e724aa7f-- From djcb.bulk@gmail.com Sat Sep 28 15:00:01 2013 Return-Path: X-Original-To: libsoup-list@gnome.org Delivered-To: libsoup-list@gnome.org Received: from localhost (localhost.localdomain [127.0.0.1]) by restaurant.gnome.org (Postfix) with ESMTP id AFBA376B27 for ; Sat, 28 Sep 2013 15:00:01 +0000 (UTC) X-Virus-Scanned: by amavisd-new at gnome.org X-Spam-Flag: NO X-Spam-Score: -0.333 X-Spam-Level: X-Spam-Status: No, score=-0.333 tagged_above=-999 required=2 tests=[BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, NML_ADSP_CUSTOM_MED=0.9, RCVD_IN_DNSWL_NONE=-0.0001, SPF_SOFTFAIL=0.665] autolearn=no Received: from restaurant.gnome.org ([127.0.0.1]) by localhost (restaurant.gnome.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2Ds2DlYm1PEF for ; Sat, 28 Sep 2013 14:59:56 +0000 (UTC) X-Greylist: delayed 499 seconds by postgrey-1.34 at restaurant.gnome.org; Sat, 28 Sep 2013 14:59:56 UTC Received: from vs14.mail.saunalahti.fi (vs14.mail.saunalahti.fi [62.142.117.201]) by restaurant.gnome.org (Postfix) with ESMTP id 003E576A58 for ; Sat, 28 Sep 2013 14:59:45 +0000 (UTC) Received: from vams (localhost [127.0.0.1]) by vs14.mail.saunalahti.fi (Postfix) with SMTP id 8B92C740049 for ; Sat, 28 Sep 2013 17:51:23 +0300 (EEST) Received: from gw03.mail.saunalahti.fi (gw03.mail.saunalahti.fi [195.197.172.111]) by vs14.mail.saunalahti.fi (Postfix) with ESMTP id 5F90F740049 for ; Sat, 28 Sep 2013 17:51:23 +0300 (EEST) Received: from wintersun (192-195-81-181.PUBLIC.monkeybrains.net [192.195.81.181]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by gw03.mail.saunalahti.fi (Postfix) with ESMTP id C37272165E7 for ; Sat, 28 Sep 2013 17:51:21 +0300 (EEST) User-agent: mu4e 0.9.9.5; emacs 24.3.1 From: Dirk-Jan C. Binnema To: libsoup-list@gnome.org Subject: client-side chunked-encoding and certificates Date: Sat, 28 Sep 2013 07:51:18 -0700 Message-ID: <87wqm13spl.fsf@djcbsoftware.nl> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: libsoup-list@gnome.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "discussion of libsoup, an HTTP library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Sep 2013 15:00:01 -0000 Hi all! I'm a happy libsoup-user, so thanks for all the hard work / thought that went into it! I particularly like the API in comparision with e.g. libcurl. However, libcurl has two features that libsoup doesn't seem to have: - client-side certificates, i.e. the ability to set a pkcs#12/pem/... certificate so the server can verify who I am. - client-side chunked encoding, i.e., the ability to send data to a server in chunks. Is this correct? Or does libsoup support these features somehow? And if not, is there any plan to implement those? Or some suggestions on how this could be done? Thanks, Dirk. -- Dirk-Jan C. Binnema Helsinki, Finland e:djcb@djcbsoftware.nl w:www.djcbsoftware.nl pgp: D09C E664 897D 7D39 5047 A178 E96A C7A1 017D DA3C From svillar@igalia.com Mon Sep 30 08:01:03 2013 Return-Path: X-Original-To: libsoup-list@gnome.org Delivered-To: libsoup-list@gnome.org Received: from localhost (localhost.localdomain [127.0.0.1]) by restaurant.gnome.org (Postfix) with ESMTP id 7E68376A60 for ; Mon, 30 Sep 2013 08:01:03 +0000 (UTC) X-Virus-Scanned: by amavisd-new at gnome.org X-Spam-Flag: NO X-Spam-Score: -2.457 X-Spam-Level: X-Spam-Status: No, score=-2.457 tagged_above=-999 required=2 tests=[BAYES_00=-1.9, RP_MATCHES_RCVD=-0.556, SPF_PASS=-0.001] autolearn=ham Received: from restaurant.gnome.org ([127.0.0.1]) by localhost (restaurant.gnome.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FqGdwkSQ9aLj for ; Mon, 30 Sep 2013 08:00:59 +0000 (UTC) Received: from fanzine.igalia.com (fanzine.igalia.com [91.117.99.155]) by restaurant.gnome.org (Postfix) with ESMTP id 0BB2876A5B for ; Mon, 30 Sep 2013 08:00:48 +0000 (UTC) Received: from maestria.local.igalia.com ([192.168.10.14] helo=mail.igalia.com) by fanzine.igalia.com with esmtps (Cipher TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim) id 1VQYPO-0007SU-9f for ; Mon, 30 Sep 2013 10:00:46 +0200 Received: from fanzine.local.igalia.com ([192.168.10.13] helo=[10.76.0.10]) by mail.igalia.com with esmtps (Cipher TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim) id 1VQYPO-0005A4-1e for ; Mon, 30 Sep 2013 10:00:46 +0200 Message-ID: <52492FA8.5050003@igalia.com> Date: Mon, 30 Sep 2013 10:00:40 +0200 From: Sergio Villar Senin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130821 Icedove/17.0.8 MIME-Version: 1.0 To: libsoup-list@gnome.org Subject: Re: client-side chunked-encoding and certificates References: <87wqm13spl.fsf@djcbsoftware.nl> In-Reply-To: <87wqm13spl.fsf@djcbsoftware.nl> X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-BeenThere: libsoup-list@gnome.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "discussion of libsoup, an HTTP library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Sep 2013 08:01:03 -0000 On 28/09/13 16:51, Dirk-Jan C. Binnema wrote: > Hi all! Hi djcb! happy to hear from you :) > I'm a happy libsoup-user, so thanks for all the hard work / thought that > went into it! I particularly like the API in comparision with > e.g. libcurl. > > However, libcurl has two features that libsoup doesn't seem to have: > > - client-side certificates, i.e. the ability to set a > pkcs#12/pem/... certificate so the server can verify who I am. client side certificates work is tracked in https://bugzilla.gnome.org/show_bug.cgi?id=334021. Don't know if Dan has some extra details but seems like the work is blocked by some missing gio bits (perhaps a nice task for this year WebKitGtk hackfest Dan?) BR From danw@gnome.org Mon Sep 30 10:58:12 2013 Return-Path: X-Original-To: libsoup-list@gnome.org Delivered-To: libsoup-list@gnome.org Received: from localhost (localhost.localdomain [127.0.0.1]) by restaurant.gnome.org (Postfix) with ESMTP id 70FED76A41 for ; Mon, 30 Sep 2013 10:58:12 +0000 (UTC) X-Virus-Scanned: by amavisd-new at gnome.org X-Spam-Flag: NO X-Spam-Score: -1.121 X-Spam-Level: X-Spam-Status: No, score=-1.121 tagged_above=-999 required=2 tests=[BAYES_00=-1.9, SPF_NEUTRAL=0.779] autolearn=no Received: from restaurant.gnome.org ([127.0.0.1]) by localhost (restaurant.gnome.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jyrxW3Ngh2Yu for ; Mon, 30 Sep 2013 10:58:08 +0000 (UTC) Received: from mysterion.org (mysterion.org [66.228.43.119]) by restaurant.gnome.org (Postfix) with ESMTP id 4A4C0762E7 for ; Mon, 30 Sep 2013 10:57:57 +0000 (UTC) Message-ID: <52495927.9000904@gnome.org> Date: Mon, 30 Sep 2013 06:57:43 -0400 From: Dan Winship User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: "Dirk-Jan C. Binnema" , libsoup-list@gnome.org Subject: Re: client-side chunked-encoding and certificates References: <87wqm13spl.fsf@djcbsoftware.nl> In-Reply-To: <87wqm13spl.fsf@djcbsoftware.nl> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-BeenThere: libsoup-list@gnome.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "discussion of libsoup, an HTTP library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Sep 2013 10:58:12 -0000 On 09/28/2013 10:51 AM, Dirk-Jan C. Binnema wrote: > - client-side certificates, i.e. the ability to set a > pkcs#12/pem/... certificate so the server can verify who I am. As Sergio pointed out, this is something that's been on the to-do list forever. However, there is a good chance it will finally happen this release cycle. (FWIW, I think it might actually be possible to do this with just the current APIs, with a little bit of work. Using the SoupMessage:network-event signal, you can get access to the GTlsConnection, and then you can fiddle with it before or during the handshake.) > - client-side chunked encoding, i.e., the ability to send data to a > server in chunks. This is possible, though not especially clean API-wise. It works the same way as server-side chunked encoding (https://developer.gnome.org/libsoup/stable/libsoup-server-howto.html#id-1.2.4.5.8); you set the encoding with soup_message_headers_set_encoding() before sending the message, and then add chunks with soup_message_append() / soup_message_append_buffer(), possibly listening to the wrote-chunk signal to know when another chunk is needed, and use soup_message_body_complete() when you're done. Eventually there will be a GOutputStream-based API for writing the request body, like the existing GInputStream-based ones for reading the response. But I'm not sure exactly when that will be. -- Dan