diff options
author | Andreas Steffen <andreas.steffen@strongswan.org> | 2013-04-01 22:31:44 +0200 |
---|---|---|
committer | Andreas Steffen <andreas.steffen@strongswan.org> | 2013-04-02 08:55:40 +0200 |
commit | c2c4125cde0936bb2b963a2acabe0fae3d6fce1f (patch) | |
tree | 51bf77b7164cf3b0c1b767f2a9fccd3e6fd1b0eb /src/libcharon/plugins/tnc_ifmap | |
parent | 96ad2b17b05d8b97f273ef21d4756d148d190eb0 (diff) | |
download | strongswan-c2c4125cde0936bb2b963a2acabe0fae3d6fce1f.tar.bz2 strongswan-c2c4125cde0936bb2b963a2acabe0fae3d6fce1f.tar.xz |
improve checking of sent and received http messages
Diffstat (limited to 'src/libcharon/plugins/tnc_ifmap')
-rw-r--r-- | src/libcharon/plugins/tnc_ifmap/tnc_ifmap_soap_msg.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_soap_msg.c b/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_soap_msg.c index 8afd6ff09..eaa835134 100644 --- a/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_soap_msg.c +++ b/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_soap_msg.c @@ -66,7 +66,7 @@ static bool http_post(private_tnc_ifmap_soap_msg_t *this, chunk_t out, { char *host, *path, *request, buf[2048]; chunk_t line, http, parameter; - int len, code, content_len = 0; + int len, written, code, content_len = 0; /* Duplicate host[/path] string since we are going to manipulate it */ len = strlen(this->uri) + 2; @@ -111,12 +111,16 @@ static bool http_post(private_tnc_ifmap_soap_msg_t *this, chunk_t out, http = chunk_create(request, len); DBG3(DBG_TLS, "%B", &http); - this->tls->write(this->tls, request, len); + written = this->tls->write(this->tls, request, len); free(request); + if (written != len) + { + return FALSE; + } /* Read HTTP response */ len = this->tls->read(this->tls, buf, sizeof(buf), TRUE); - if (len == -1) + if (len <= 0) { return FALSE; } |