Small wrapper of TLS_cyassl
Dependents: HTTPSClientExample2
This is a small wrapper of TLS_cyassl to easily sends GET requests over HTTPS. This library is used in the same way as HTTPSClient_axTLS.
Import programHTTPSClientExample2
This example shows how to use the TLS_cyassl library. It connects to twitter.com and downloads a webpage.
HTTPHeader.cpp@0:1abc65a0f50b, 2013-09-16 (annotated)
- Committer:
- feb11
- Date:
- Mon Sep 16 10:39:01 2013 +0000
- Revision:
- 0:1abc65a0f50b
initial import
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
feb11 | 0:1abc65a0f50b | 1 | #include "HTTPHeader.h" |
feb11 | 0:1abc65a0f50b | 2 | |
feb11 | 0:1abc65a0f50b | 3 | HTTPHeader::HTTPHeader(HTTPStatus status): |
feb11 | 0:1abc65a0f50b | 4 | _status(status), |
feb11 | 0:1abc65a0f50b | 5 | _bodyLength(0) |
feb11 | 0:1abc65a0f50b | 6 | { |
feb11 | 0:1abc65a0f50b | 7 | } |
feb11 | 0:1abc65a0f50b | 8 | |
feb11 | 0:1abc65a0f50b | 9 | std::string HTTPHeader::getRequest(const std::string &path, const std::string &host, const int port) |
feb11 | 0:1abc65a0f50b | 10 | { |
feb11 | 0:1abc65a0f50b | 11 | |
feb11 | 0:1abc65a0f50b | 12 | std::string request = "GET "; |
feb11 | 0:1abc65a0f50b | 13 | request += path; |
feb11 | 0:1abc65a0f50b | 14 | request += " HTTP/1.0\r\nHost: "; |
feb11 | 0:1abc65a0f50b | 15 | request += host; |
feb11 | 0:1abc65a0f50b | 16 | request += ":"; |
feb11 | 0:1abc65a0f50b | 17 | request += port; |
feb11 | 0:1abc65a0f50b | 18 | request += "\r\n\r\n"; |
feb11 | 0:1abc65a0f50b | 19 | return request; |
feb11 | 0:1abc65a0f50b | 20 | } |
feb11 | 0:1abc65a0f50b | 21 | |
feb11 | 0:1abc65a0f50b | 22 | HTTPStatus HTTPHeader::getStatus() const |
feb11 | 0:1abc65a0f50b | 23 | { |
feb11 | 0:1abc65a0f50b | 24 | return _status; |
feb11 | 0:1abc65a0f50b | 25 | } |
feb11 | 0:1abc65a0f50b | 26 | |
feb11 | 0:1abc65a0f50b | 27 | int HTTPHeader::getBodyLength() const |
feb11 | 0:1abc65a0f50b | 28 | { |
feb11 | 0:1abc65a0f50b | 29 | return _bodyLength; |
feb11 | 0:1abc65a0f50b | 30 | } |
feb11 | 0:1abc65a0f50b | 31 |