summaryrefslogtreecommitdiffstats
path: root/nanohttp/nanohttp-client.c
diff options
context:
space:
mode:
Diffstat (limited to 'nanohttp/nanohttp-client.c')
-rw-r--r--nanohttp/nanohttp-client.c88
1 files changed, 44 insertions, 44 deletions
diff --git a/nanohttp/nanohttp-client.c b/nanohttp/nanohttp-client.c
index 814f0b4..2f79bc0 100644
--- a/nanohttp/nanohttp-client.c
+++ b/nanohttp/nanohttp-client.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: nanohttp-client.c,v 1.25 2004/11/02 22:42:52 snowdrop Exp $
+* $Id: nanohttp-client.c,v 1.26 2004/11/02 23:09:26 snowdrop Exp $
*
* CSOAP Project: A http client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -50,22 +50,22 @@ NOTE: This will be called from soap_client_init_args()
----------------------------------------------------*/
herror_t
httpc_init(int argc, char *argv[])
-{
- hoption_init_args(argc, argv);
- hsocket_module_init();
+{
+ hoption_init_args(argc, argv);
+ hsocket_module_init();
return H_OK;
}
-
-
-/*--------------------------------------------------
-FUNCTION: httpc_destroy
-DESC: Destroy the http client module
-----------------------------------------------------*/
-void httpc_destroy()
-{
- hsocket_module_destroy();
-}
-
+
+
+/*--------------------------------------------------
+FUNCTION: httpc_destroy
+DESC: Destroy the http client module
+----------------------------------------------------*/
+void httpc_destroy()
+{
+ hsocket_module_destroy();
+}
+
/*--------------------------------------------------
FUNCTION: httpc_new
@@ -85,7 +85,7 @@ httpc_new()
res->out = NULL;
res->_dime_package_nr = 0;
res->_dime_sent_bytes = 0;
- res->id = counter++;
+ res->id = counter++;
res->block = 0;
return res;
}
@@ -270,16 +270,16 @@ static
herror_t
httpc_talk_to_server(hreq_method_t method, httpc_conn_t * conn,
const char *urlstr)
-{
+{
hurl_t url;
char buffer[4096];
herror_t status;
if (conn == NULL) {
- return herror_new(
- "httpc_talk_to_server",
- GENERAL_INVALID_PARAM,
+ return herror_new(
+ "httpc_talk_to_server",
+ GENERAL_INVALID_PARAM,
"httpc_conn_t param is NULL");
}
/* Build request header */
@@ -323,17 +323,17 @@ httpc_talk_to_server(hreq_method_t method, httpc_conn_t * conn,
} else {
log_error1("Unknown method type!");
- return herror_new(
- "httpc_talk_to_server",
- GENERAL_INVALID_PARAM,
- "hreq_method_t must be HTTP_REQUEST_GET or HTTP_REQUEST_POST");
+ return herror_new(
+ "httpc_talk_to_server",
+ GENERAL_INVALID_PARAM,
+ "hreq_method_t must be HTTP_REQUEST_GET or HTTP_REQUEST_POST");
}
status = hsocket_send(conn->sock, buffer);
if (status != H_OK) {
log_error2("Can not send request (status:%d)", status);
hsocket_close(conn->sock);
- return status;
+ return status;
}
/* Send Header */
status = httpc_send_header(conn);
@@ -341,7 +341,7 @@ httpc_talk_to_server(hreq_method_t method, httpc_conn_t * conn,
log_error2("Can not send header (status:%d)", status);
hsocket_close(conn->sock);
return status;
- }
+ }
return H_OK;
@@ -368,7 +368,7 @@ httpc_get(httpc_conn_t *conn, hresponse_t** out, const char *urlstr)
{
return status;
}
-
+
return H_OK;
}
@@ -411,10 +411,10 @@ herror_t httpc_post_end(httpc_conn_t *conn, hresponse_t** out)
status = hresponse_new_from_socket(conn->sock, out);
if (status != H_OK)
- {
+ {
return status;
}
-
+
return H_OK;
}
@@ -423,7 +423,7 @@ herror_t httpc_post_end(httpc_conn_t *conn, hresponse_t** out)
/* ---------------------------------------------------
DIME support functions httpc_dime_* function set
-----------------------------------------------------*/
-/*
+/*
int httpc_dime_begin(httpc_conn_t *conn, const char *url)
{
int status;
@@ -595,12 +595,12 @@ herror_t httpc_mime_begin(httpc_conn_t *conn, const char *url,
*/
sprintf(buffer, "multipart/related;");
- /*
- using sprintf instead of snprintf because visual c does not support snprintf
- */
-#ifdef WIN32
-#define snprintf(buffer, num, s1, s2) sprintf(buffer, s1,s2)
-#endif
+ /*
+ using sprintf instead of snprintf because visual c does not support snprintf
+ */
+#ifdef WIN32
+#define snprintf(buffer, num, s1, s2) sprintf(buffer, s1,s2)
+#endif
if (related_type) {
snprintf(temp, 75, " type=\"%s\";", related_type);
@@ -691,7 +691,7 @@ herror_t httpc_mime_end(httpc_conn_t *conn, hresponse_t** out)
{
return status;
}
-
+
return H_OK;
}
@@ -713,7 +713,7 @@ httpc_mime_send_file (httpc_conn_t * conn,
size_t size;
if (fd == NULL)
- return herror_new("httpc_mime_send_file", FILE_ERROR_OPEN,
+ return herror_new("httpc_mime_send_file", FILE_ERROR_OPEN,
"Can not open file '%s'", filename);
status =
@@ -730,22 +730,22 @@ httpc_mime_send_file (httpc_conn_t * conn,
if (size == -1)
{
fclose (fd);
- return herror_new("httpc_mime_send_file", FILE_ERROR_READ,
+ return herror_new("httpc_mime_send_file", FILE_ERROR_READ,
"Can not read from file '%s'", filename);
}
-
- if (size>0)
- {
+
+ if (size>0)
+ {
/*DEBUG: fwrite(buffer, 1, size, stdout);*/
status = http_output_stream_write (conn->out, buffer, size);
if (status != H_OK) {
fclose (fd);
return status;
- }
+ }
}
}
- fclose (fd);
+ fclose (fd);
log_verbose1("file sent!");
return H_OK;
}