nkjnm
Dependencies: MAX44000 nexpaq_mdk
Fork of LED_Demo by
mbd_os/libraries/net/https/HTTPHeader.cpp@7:3a65ef12ba31, 2016-11-04 (annotated)
- Committer:
- nitsshukla
- Date:
- Fri Nov 04 12:06:04 2016 +0000
- Revision:
- 7:3a65ef12ba31
- Parent:
- 1:55a6170b404f
kghj;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nexpaq | 1:55a6170b404f | 1 | #include "HTTPHeader.h" |
nexpaq | 1:55a6170b404f | 2 | #include <stdlib.h> |
nexpaq | 1:55a6170b404f | 3 | using std::map; |
nexpaq | 1:55a6170b404f | 4 | using std::string; |
nexpaq | 1:55a6170b404f | 5 | |
nexpaq | 1:55a6170b404f | 6 | HTTPHeader::HTTPHeader(): |
nexpaq | 1:55a6170b404f | 7 | _status(HTTP_ERROR), |
nexpaq | 1:55a6170b404f | 8 | _fields() |
nexpaq | 1:55a6170b404f | 9 | { |
nexpaq | 1:55a6170b404f | 10 | } |
nexpaq | 1:55a6170b404f | 11 | |
nexpaq | 1:55a6170b404f | 12 | std::string HTTPHeader::getField(const std::string& name) |
nexpaq | 1:55a6170b404f | 13 | { |
nexpaq | 1:55a6170b404f | 14 | map<string,string>::iterator itor = _fields.find(name); |
nexpaq | 1:55a6170b404f | 15 | if(itor == _fields.end()) |
nexpaq | 1:55a6170b404f | 16 | return string(); |
nexpaq | 1:55a6170b404f | 17 | return itor->second; |
nexpaq | 1:55a6170b404f | 18 | } |
nexpaq | 1:55a6170b404f | 19 | |
nexpaq | 1:55a6170b404f | 20 | int HTTPHeader::getBodyLength() |
nexpaq | 1:55a6170b404f | 21 | { |
nexpaq | 1:55a6170b404f | 22 | return atoi(getField("Content-Length").c_str()); |
nexpaq | 1:55a6170b404f | 23 | } |
nexpaq | 1:55a6170b404f | 24 |