mirror of
				https://github.com/acmesh-official/acme.sh
				synced 2025-11-04 13:55:56 +08:00 
			
		
		
		
	Merge pull request #4448 from PMExtra/feature/curl_fail
curl return fail if HTTP errors
This commit is contained in:
		
							
								
								
									
										15
									
								
								acme.sh
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								acme.sh
									
									
									
									
									
								
							@@ -1852,9 +1852,14 @@ _inithttp() {
 | 
			
		||||
      _ACME_CURL="$_ACME_CURL --cacert $CA_BUNDLE "
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    if _contains "$(curl --help 2>&1)" "--globoff"; then
 | 
			
		||||
    if _contains "$(curl --help 2>&1)" "--globoff" || _contains "$(curl --help curl 2>&1)" "--globoff"; then
 | 
			
		||||
      _ACME_CURL="$_ACME_CURL -g "
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    #from curl 7.76: return fail on HTTP errors but keep the body
 | 
			
		||||
    if _contains "$(curl --help http 2>&1)" "--fail-with-body"; then
 | 
			
		||||
      _ACME_CURL="$_ACME_CURL --fail-with-body "
 | 
			
		||||
    fi
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  if [ -z "$_ACME_WGET" ] && _exists "wget"; then
 | 
			
		||||
@@ -1872,11 +1877,11 @@ _inithttp() {
 | 
			
		||||
    elif [ "$CA_BUNDLE" ]; then
 | 
			
		||||
      _ACME_WGET="$_ACME_WGET --ca-certificate=$CA_BUNDLE "
 | 
			
		||||
    fi
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  #from wget 1.14: do not skip body on 404 error
 | 
			
		||||
  if [ "$_ACME_WGET" ] && _contains "$($_ACME_WGET --help 2>&1)" "--content-on-error"; then
 | 
			
		||||
    _ACME_WGET="$_ACME_WGET --content-on-error "
 | 
			
		||||
    #from wget 1.14: do not skip body on 404 error
 | 
			
		||||
    if _contains "$(wget --help 2>&1)" "--content-on-error"; then
 | 
			
		||||
      _ACME_WGET="$_ACME_WGET --content-on-error "
 | 
			
		||||
    fi
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  __HTTP_INITIALIZED=1
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user