Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: FlashAir_Twitter CyaSSL-Twitter-OAuth4Tw TweetTest NetworkThermometer ... more
Fork of OAuth4Tw by
HTTPPostText.cpp@4:1ecf49a46040, 2015-07-08 (annotated)
- Committer:
- ban4jp
- Date:
- Wed Jul 08 14:32:26 2015 +0000
- Revision:
- 4:1ecf49a46040
- Parent:
- 1:0036880e6f71
Add GET method, and changed the API.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ban4jp | 1:0036880e6f71 | 1 | /* HTTPPostText.cpp */ |
| ban4jp | 1:0036880e6f71 | 2 | /* Copyright (C) 2012 mbed.org, MIT License |
| ban4jp | 1:0036880e6f71 | 3 | * |
| ban4jp | 1:0036880e6f71 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
| ban4jp | 1:0036880e6f71 | 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
| ban4jp | 1:0036880e6f71 | 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
| ban4jp | 1:0036880e6f71 | 7 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
| ban4jp | 1:0036880e6f71 | 8 | * furnished to do so, subject to the following conditions: |
| ban4jp | 1:0036880e6f71 | 9 | * |
| ban4jp | 1:0036880e6f71 | 10 | * The above copyright notice and this permission notice shall be included in all copies or |
| ban4jp | 1:0036880e6f71 | 11 | * substantial portions of the Software. |
| ban4jp | 1:0036880e6f71 | 12 | * |
| ban4jp | 1:0036880e6f71 | 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
| ban4jp | 1:0036880e6f71 | 14 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| ban4jp | 1:0036880e6f71 | 15 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
| ban4jp | 1:0036880e6f71 | 16 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| ban4jp | 1:0036880e6f71 | 17 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| ban4jp | 1:0036880e6f71 | 18 | */ |
| ban4jp | 1:0036880e6f71 | 19 | |
| ban4jp | 1:0036880e6f71 | 20 | #include "HTTPPostText.h" |
| ban4jp | 1:0036880e6f71 | 21 | |
| ban4jp | 1:0036880e6f71 | 22 | #include <cstring> |
| ban4jp | 1:0036880e6f71 | 23 | |
| ban4jp | 1:0036880e6f71 | 24 | #define OK 0 |
| ban4jp | 1:0036880e6f71 | 25 | |
| ban4jp | 1:0036880e6f71 | 26 | using std::memcpy; |
| ban4jp | 1:0036880e6f71 | 27 | using std::strncpy; |
| ban4jp | 1:0036880e6f71 | 28 | using std::strlen; |
| ban4jp | 1:0036880e6f71 | 29 | |
| ban4jp | 1:0036880e6f71 | 30 | HTTPPostText::HTTPPostText(char* str) : HTTPText(str) |
| ban4jp | 1:0036880e6f71 | 31 | { |
| ban4jp | 1:0036880e6f71 | 32 | |
| ban4jp | 1:0036880e6f71 | 33 | } |
| ban4jp | 1:0036880e6f71 | 34 | |
| ban4jp | 1:0036880e6f71 | 35 | HTTPPostText::HTTPPostText(char* str, size_t size) : HTTPText(str, size) |
| ban4jp | 1:0036880e6f71 | 36 | { |
| ban4jp | 1:0036880e6f71 | 37 | |
| ban4jp | 1:0036880e6f71 | 38 | } |
| ban4jp | 1:0036880e6f71 | 39 | |
| ban4jp | 1:0036880e6f71 | 40 | //IHTTPDataIn |
| ban4jp | 1:0036880e6f71 | 41 | /*virtual*/ int HTTPPostText::getDataType(char* type, size_t maxTypeLen) //Internet media type for Content-Type header |
| ban4jp | 1:0036880e6f71 | 42 | { |
| ban4jp | 1:0036880e6f71 | 43 | strncpy(type, "application/x-www-form-urlencoded", maxTypeLen-1); |
| ban4jp | 1:0036880e6f71 | 44 | type[maxTypeLen-1] = '\0'; |
| ban4jp | 1:0036880e6f71 | 45 | return OK; |
| ban4jp | 1:0036880e6f71 | 46 | } |
| ban4jp | 1:0036880e6f71 | 47 | |
| ban4jp | 1:0036880e6f71 | 48 | //IHTTPDataOut |
| ban4jp | 1:0036880e6f71 | 49 | /*virtual*/ void HTTPPostText::setDataType(const char* type) //Internet media type from Content-Type header |
| ban4jp | 1:0036880e6f71 | 50 | { |
| ban4jp | 1:0036880e6f71 | 51 | |
| ban4jp | 1:0036880e6f71 | 52 | } |
