@@ -49,12 +49,6 @@ struct HttpHeaderLine {
49
49
HttpHeaderLine (const char * k) { key = k; }
50
50
};
51
51
52
- /* *
53
- * @brief workng buffer on the heap
54
- */
55
-
56
- static Vector<char > temp_buffer{0 };
57
-
58
52
/* *
59
53
* @brief In a http request and reply we need to process header information.
60
54
* With this API we can define and query the header information. The individual
@@ -302,7 +296,7 @@ class HttpHeader {
302
296
bool isRedirectStatus () { return status_code >= 300 && status_code < 400 ; }
303
297
304
298
// / release static temp buffer
305
- static void end () { temp_buffer.resize (0 ); }
299
+ void end () { temp_buffer.resize (0 ); }
306
300
307
301
// / Set the timout
308
302
void setTimeout (int timeoutMs) { timeout_ms = timeoutMs; }
@@ -313,6 +307,11 @@ class HttpHeader {
313
307
// / Defines the protocol: e.g. HTTP/1.1
314
308
void setProtocol (const char * protocal) { protocol_str = protocal; }
315
309
310
+ // / Resizes the internal read buffer
311
+ void resize (int bufferSize){
312
+ temp_buffer.resize (bufferSize);
313
+ }
314
+
316
315
protected:
317
316
int status_code = UNDEFINED;
318
317
bool is_written = false ;
@@ -329,9 +328,9 @@ class HttpHeader {
329
328
HttpLineReader reader;
330
329
const char * CRLF = " \r\n " ;
331
330
int timeout_ms = URL_CLIENT_TIMEOUT;
331
+ Vector<char > temp_buffer{HTTP_MAX_LEN};
332
332
333
333
char * tempBuffer () {
334
- temp_buffer.resize (HTTP_MAX_LEN);
335
334
temp_buffer.clear ();
336
335
return temp_buffer.data ();
337
336
}
0 commit comments