Change buffer sizes to support GR-PEACH
Dependents: GR-PEACH_Azure_Speech
Fork of HTTPClient-SSL by
data/HTTPJson.cpp@50:7fbf8ef951f2, 2015-11-07 (annotated)
- Committer:
- ksekimoto
- Date:
- Sat Nov 07 12:20:31 2015 +0000
- Revision:
- 50:7fbf8ef951f2
- Parent:
- 29:2d96cc752d19
The first version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ansond | 29:2d96cc752d19 | 1 | /* HTTPJson.cpp */ |
ansond | 29:2d96cc752d19 | 2 | /* Copyright (C) 2012 mbed.org, MIT License |
ansond | 29:2d96cc752d19 | 3 | * |
ansond | 29:2d96cc752d19 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
ansond | 29:2d96cc752d19 | 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
ansond | 29:2d96cc752d19 | 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
ansond | 29:2d96cc752d19 | 7 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
ansond | 29:2d96cc752d19 | 8 | * furnished to do so, subject to the following conditions: |
ansond | 29:2d96cc752d19 | 9 | * |
ansond | 29:2d96cc752d19 | 10 | * The above copyright notice and this permission notice shall be included in all copies or |
ansond | 29:2d96cc752d19 | 11 | * substantial portions of the Software. |
ansond | 29:2d96cc752d19 | 12 | * |
ansond | 29:2d96cc752d19 | 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
ansond | 29:2d96cc752d19 | 14 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
ansond | 29:2d96cc752d19 | 15 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
ansond | 29:2d96cc752d19 | 16 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
ansond | 29:2d96cc752d19 | 17 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
ansond | 29:2d96cc752d19 | 18 | */ |
ansond | 29:2d96cc752d19 | 19 | |
ansond | 29:2d96cc752d19 | 20 | #include "HTTPJson.h" |
ansond | 29:2d96cc752d19 | 21 | |
ansond | 29:2d96cc752d19 | 22 | #define OK 0 |
ansond | 29:2d96cc752d19 | 23 | |
ansond | 29:2d96cc752d19 | 24 | using std::strncpy; |
ansond | 29:2d96cc752d19 | 25 | |
ansond | 29:2d96cc752d19 | 26 | HTTPJson::HTTPJson(char* json_str) : HTTPText(json_str) |
ansond | 29:2d96cc752d19 | 27 | { |
ansond | 29:2d96cc752d19 | 28 | |
ansond | 29:2d96cc752d19 | 29 | } |
ansond | 29:2d96cc752d19 | 30 | |
ansond | 29:2d96cc752d19 | 31 | HTTPJson::HTTPJson(char* json_str, size_t size) : HTTPText(json_str,size) |
ansond | 29:2d96cc752d19 | 32 | { |
ansond | 29:2d96cc752d19 | 33 | |
ansond | 29:2d96cc752d19 | 34 | } |
ansond | 29:2d96cc752d19 | 35 | |
ansond | 29:2d96cc752d19 | 36 | /*virtual*/ int HTTPJson::getDataType(char* type, size_t maxTypeLen) //Internet media type for Content-Type header |
ansond | 29:2d96cc752d19 | 37 | { |
ansond | 29:2d96cc752d19 | 38 | strncpy(type, "application/json", maxTypeLen-1); |
ansond | 29:2d96cc752d19 | 39 | type[maxTypeLen-1] = '\0'; |
ansond | 29:2d96cc752d19 | 40 | return OK; |
ansond | 29:2d96cc752d19 | 41 | } |