mirror of
				https://github.com/esp8266/Arduino.git
				synced 2025-11-03 14:33:37 +03:00 
			
		
		
		
	improve handling of non http servers
This commit is contained in:
		@@ -386,6 +386,9 @@ int httpClient::handleHeaderResponse() {
 | 
			
		||||
        return HTTPC_ERROR_NOT_CONNECTED;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    _returnCode = -1;
 | 
			
		||||
    _size = -1;
 | 
			
		||||
 | 
			
		||||
    while(connected()) {
 | 
			
		||||
        size_t len = _tcp->available();
 | 
			
		||||
        if(len > 0) {
 | 
			
		||||
@@ -421,7 +424,12 @@ int httpClient::handleHeaderResponse() {
 | 
			
		||||
                if(_size) {
 | 
			
		||||
                    DEBUG_HTTPCLIENT("[HTTP-Client][handleHeaderResponse] size: %d\n", _size);
 | 
			
		||||
                }
 | 
			
		||||
                return _returnCode;
 | 
			
		||||
                if(_returnCode) {
 | 
			
		||||
                    return _returnCode;
 | 
			
		||||
                } else {
 | 
			
		||||
                    DEBUG_HTTPCLIENT("[HTTP-Client][handleHeaderResponse] Remote host is not an HTTP Server!");
 | 
			
		||||
                    return HTTPC_ERROR_NO_HTTP_SERVER;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        } else {
 | 
			
		||||
 
 | 
			
		||||
@@ -40,6 +40,7 @@
 | 
			
		||||
#define HTTPC_ERROR_NOT_CONNECTED       (-4)
 | 
			
		||||
#define HTTPC_ERROR_CONNECTION_LOST     (-5)
 | 
			
		||||
#define HTTPC_ERROR_NO_STREAM           (-6)
 | 
			
		||||
#define HTTPC_ERROR_NO_HTTP_SERVER      (-7)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class httpClient {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user