Skip to content

Instantly share code, notes, and snippets.

@t-8ch
Last active December 14, 2015 03:18
Show Gist options
  • Save t-8ch/5019420 to your computer and use it in GitHub Desktop.
Save t-8ch/5019420 to your computer and use it in GitHub Desktop.
Simple test for libsoup
/*
* 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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment