dhgdh
Dependencies: MAX44000 PWM_Tone_Library nexpaq_mdk
Fork of LED_Demo by
mbd_os/libraries/net/https/HTTPHeader.cpp@1:55a6170b404f, 2016-09-17 (annotated)
- Committer:
- nexpaq
- Date:
- Sat Sep 17 16:32:05 2016 +0000
- Revision:
- 1:55a6170b404f
checking in for sharing
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 |