Re: got_chunk signal




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 <danw gnome org> 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




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]