Last active
December 14, 2015 03:18
-
-
Save t-8ch/5019420 to your computer and use it in GitHub Desktop.
Simple test for libsoup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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