Skip to content

Instantly share code, notes, and snippets.

@t-8ch
Last active December 14, 2015 03:18
Show Gist options
  • Select an option

  • Save t-8ch/5019420 to your computer and use it in GitHub Desktop.

Select an option

Save t-8ch/5019420 to your computer and use it in GitHub Desktop.

Revisions

  1. t-8ch revised this gist Feb 23, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion test_libsoup_msg.c
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    /*
    * file: test_libsoup_msg.c
    * compile with:
    * cc $(pkg-config --cflags --libs libsoup-2.4) * test_libsoup_msg.c -o test_libsoup_msg
    * cc $(pkg-config --cflags --libs libsoup-2.4) test_libsoup_msg.c -o test_libsoup_msg
    */

    #include <libsoup/soup.h>
  2. t-8ch created this gist Feb 23, 2013.
    29 changes: 29 additions & 0 deletions test_libsoup_msg.c
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    /*
    * file: test_libsoup_msg.c
    * compile with:
    * cc $(pkg-config --cflags --libs libsoup-2.4) * test_libsoup_msg.c -o test_libsoup_msg
    */

    #include <libsoup/soup.h>
    #include <glib/gprintf.h>

    int main(int argc, char** argv) {
    SoupSession *session;
    SoupMessage *msg;

    if(argc != 2) {
    g_printerr("No URL given\n");
    return 3;
    }

    g_type_init();

    session = soup_session_sync_new();
    msg = soup_message_new("GET", argv[1]);
    soup_session_send_message(session, msg);

    g_printf("Statuscode: %u\n"
    "Reason: %s\n",
    msg->status_code, msg->reason_phrase);
    return 0;
    }