If two headers with overlapping names are added while replace == true, like in:
```cpp
http.addHeader("api_token",  "pMXFOLpinQqajaRQJYMeWObg2XYmcX1");
http.addHeader("token", "1234");
```
then replacing went wrong. This is fixed with this PR.
			
			
This commit is contained in:
		
							parent
							
								
									8869d39d79
								
							
						
					
					
						commit
						7de1717640
					
				| @ -910,7 +910,7 @@ void HTTPClient::addHeader(const String& name, const String& value, bool first, | ||||
| 
 | ||||
|         if (replace) { | ||||
|             int headerStart = _headers.indexOf(headerLine); | ||||
|             if (headerStart != -1) { | ||||
|             if (headerStart != -1 && (headerStart == 0 || _headers[headerStart - 1] == '\n')) { | ||||
|                 int headerEnd = _headers.indexOf('\n', headerStart); | ||||
|                 _headers = _headers.substring(0, headerStart) + _headers.substring(headerEnd + 1); | ||||
|             } | ||||
| @ -924,7 +924,6 @@ void HTTPClient::addHeader(const String& name, const String& value, bool first, | ||||
|             _headers += headerLine; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| void HTTPClient::collectHeaders(const char* headerKeys[], const size_t headerKeysCount) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user