Downloading a Web page in C using neon

#include <stdio.h>

#include <neon/ne_socket.h>
#include <neon/ne_session.h>
#include <neon/ne_request.h>

int main(void)
{
    ne_sock_init();	 
    ne_session *session = ne_session_create("http",	"www.martinbroadhurst.com", 80);
    ne_request *request = ne_request_create(session, "GET", "/");
    if (ne_begin_request(request) == NE_OK) {
        char buf[1024];
        size_t bytes_read;
        while ((bytes_read = ne_read_response_block(request, buf, 1024)) > 0) {
            printf("%.*s", (int)bytes_read, buf);
        }
        ne_end_request(request);
    }
    else {
        printf("Failed to dispatch request\n");
    }
    ne_request_destroy(request);
    ne_close_connection(session);
    ne_session_destroy(session);
    ne_sock_exit();	 
    return 0;
}

Reference: neon HTTP and WebDAV client library