mirror of
				https://github.com/hiskang/acme.sh
				synced 2025-10-31 10:27:22 +00:00 
			
		
		
		
	provide a more general purpose request function
This allows for more flexibility in the future. Most importantly being able to do more than just GET requests but any HTTP method. Specifically needed for DELETE requests.
This commit is contained in:
		
							parent
							
								
									2b09253961
								
							
						
					
					
						commit
						f4e81953ce
					
				
							
								
								
									
										15
									
								
								acme.sh
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								acme.sh
									
									
									
									
									
								
							| @ -1592,12 +1592,17 @@ _post() { | ||||
|   return $_ret | ||||
| } | ||||
| 
 | ||||
| # url getheader timeout | ||||
| _get() { | ||||
|   _debug GET | ||||
|   _request "$1" "$2" "$3" GET | ||||
| } | ||||
| 
 | ||||
| # url getheader timeout | ||||
| _request() { | ||||
|   url="$1" | ||||
|   onlyheader="$2" | ||||
|   t="$3" | ||||
|   method="$4" | ||||
|   _debug method $method | ||||
|   _debug url "$url" | ||||
|   _debug "timeout" "$t" | ||||
| 
 | ||||
| @ -1611,6 +1616,9 @@ _get() { | ||||
|     if [ "$t" ]; then | ||||
|       _CURL="$_CURL --connect-timeout $t" | ||||
|     fi | ||||
|     if [ "$method" ]; then | ||||
|       _CURL="$_CURL -X $method" | ||||
|     fi | ||||
|     _debug "_CURL" "$_CURL" | ||||
|     if [ "$onlyheader" ]; then | ||||
|       $_CURL -I --user-agent "$USER_AGENT" -H "$_H1" -H "$_H2" -H "$_H3" -H "$_H4" -H "$_H5" "$url" | ||||
| @ -1633,6 +1641,9 @@ _get() { | ||||
|     if [ "$t" ]; then | ||||
|       _WGET="$_WGET --timeout=$t" | ||||
|     fi | ||||
|     if [ "$method" ]; then | ||||
|       _WGET="$_WGET --method=$method" | ||||
|     fi | ||||
|     _debug "_WGET" "$_WGET" | ||||
|     if [ "$onlyheader" ]; then | ||||
|       $_WGET --user-agent="$USER_AGENT" --header "$_H5" --header "$_H4" --header "$_H3" --header "$_H2" --header "$_H1" -S -O /dev/null "$url" 2>&1 | sed 's/^[ ]*//g' | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user