wrapper of TLS library to connect to HTTPS servers
Dependents: HTTPSClientExample
This library provides a simple interface to send GET requests over HTTPS. Notice that this library uses the axTLS library for the implementation of TLS.
Import programHTTPSClientExample
Connect to twitter.com and copies this webpage to a file.
Revision 3:18af58231990, committed 2013-09-12
- Comitter:
- feb11
- Date:
- Thu Sep 12 09:05:02 2013 +0000
- Parent:
- 2:6d7bc51cc77b
- Commit message:
- fixed scanf status line
Changed in this revision
HTTPHeader.cpp | Show annotated file Show diff for this revision Revisions of this file |
HTTPSClient.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/HTTPHeader.cpp Thu Sep 05 14:28:29 2013 +0000 +++ b/HTTPHeader.cpp Thu Sep 12 09:05:02 2013 +0000 @@ -8,14 +8,14 @@ std::string HTTPHeader::getRequest(const std::string &path, const std::string &host, const int port) { + std::string request = "GET "; request += path; - request += " HTTP/1.1\r\nHost: "; + request += " HTTP/1.0\r\nHost: "; request += host; request += ":"; request += port; request += "\r\n\r\n"; - return request; }
--- a/HTTPSClient.cpp Thu Sep 05 14:28:29 2013 +0000 +++ b/HTTPSClient.cpp Thu Sep 12 09:05:02 2013 +0000 @@ -33,7 +33,7 @@ { HTTPHeader hdr; std::string line = readLine(); - sscanf(line.c_str(), "HTTP/1.1 %d OK", &hdr._status); + sscanf(line.c_str(), "HTTP/1.%*d %d OK", &hdr._status); do { if(!line.compare(0,strlen("Content-Length"), "Content-Length")) sscanf(line.c_str(), "Content-Length: %d", &hdr._bodyLength);