From 84693bb5f792e6d6accd1ad2e81fe6baeb4f4ea1 Mon Sep 17 00:00:00 2001 From: snowdrop Date: Mon, 19 Dec 2005 14:06:15 +0000 Subject: integrated with ssl (https) capability --- nanohttp/nanohttp-client.c | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) (limited to 'nanohttp/nanohttp-client.c') diff --git a/nanohttp/nanohttp-client.c b/nanohttp/nanohttp-client.c index fc1d8f5..79d6b0a 100644 --- a/nanohttp/nanohttp-client.c +++ b/nanohttp/nanohttp-client.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: nanohttp-client.c,v 1.28 2005/07/27 07:45:56 snowdrop Exp $ +* $Id: nanohttp-client.c,v 1.29 2005/12/19 14:06:16 snowdrop Exp $ * * CSOAP Project: A http client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -81,7 +81,9 @@ httpc_new() static int counter = 10000; httpc_conn_t *res = (httpc_conn_t *) malloc(sizeof(httpc_conn_t)); - hsocket_init(&res->sock); + if(hsocket_init(&res->sock)!= H_OK){ + return NULL; + } res->header = NULL; res->version = HTTP_1_1; res->out = NULL; @@ -92,19 +94,6 @@ httpc_new() return res; } -/*-------------------------------------------------- -FUNCTION: httpc_close_free -DESC: Close and free the given http client object. -----------------------------------------------------*/ -void -httpc_close_free(httpc_conn_t * conn) -{ - if (conn == NULL) - return; - - hsocket_close(conn->sock); - httpc_free(conn); -} /*-------------------------------------------------- FUNCTION: httpc_free @@ -316,11 +305,14 @@ httpc_talk_to_server(hreq_method_t method, httpc_conn_t * conn, if (status != H_OK) { return status; } - status = hsocket_block(conn->sock, conn->block); - if (status != H_OK) { - log_error1("Cannot make socket non-blocking"); - return status; - } + /* TODO XXX XXX this is probably not right -- matt */ + if(!&conn->sock.ssl){ + status = hsocket_block(conn->sock, conn->block); + if (status != H_OK) { + log_error1("Cannot make socket non-blocking"); + return status; + } + } /* check method */ if (method == HTTP_REQUEST_GET) { @@ -344,6 +336,7 @@ httpc_talk_to_server(hreq_method_t method, httpc_conn_t * conn, "hreq_method_t must be HTTP_REQUEST_GET or HTTP_REQUEST_POST"); } + log_verbose1("Sending header..."); status = hsocket_send(conn->sock, buffer); if (status != H_OK) { log_error2("Can not send request (status:%d)", status); -- cgit v1.1-32-gdbae