change http call to HttpUtils_BlockingGet
This commit is contained in:
		
							
								
								
									
										35
									
								
								77_UWZ.pm
									
									
									
									
									
								
							
							
						
						
									
										35
									
								
								77_UWZ.pm
									
									
									
									
									
								
							| @@ -166,6 +166,7 @@ BEGIN { | |||||||
|           BlockingKill |           BlockingKill | ||||||
|           init_done |           init_done | ||||||
|           FW_httpheader |           FW_httpheader | ||||||
|  |           HttpUtils_BlockingGet | ||||||
|           deviceEvents) |           deviceEvents) | ||||||
|     ); |     ); | ||||||
| } | } | ||||||
| @@ -844,27 +845,25 @@ sub JSONAcquire($$) { | |||||||
|  |  | ||||||
|     Log $hash, 4, "Start capturing of $URL"; |     Log $hash, 4, "Start capturing of $URL"; | ||||||
|  |  | ||||||
|     my $err_log = ""; |     my $param = { | ||||||
|     my $agent   = LWP::UserAgent->new( |         url     => "$URL", | ||||||
|         env_proxy         => 1, |         timeout => 5, | ||||||
|         keep_alive        => 1, |         hash    => $hash, | ||||||
|         protocols_allowed => ['http'], |         method  => "GET", | ||||||
|         timeout           => 10 |         header  => "", | ||||||
|     ); |     }; | ||||||
|     my $request = HTTP::Request->new( GET => $URL ); |  | ||||||
|     my $response = $agent->request($request); |  | ||||||
|     $err_log = "Can't get $URL -- " . $response->status_line |  | ||||||
|       unless ( $response->is_success ); |  | ||||||
|  |  | ||||||
|     if ( $err_log ne "" ) { |     my ( $err, $data ) = HttpUtils_BlockingGet($param); | ||||||
|         readingsSingleUpdate( $hash, "lastConnection", $response->status_line, |  | ||||||
|             1 ); |     if ( $err ne "" ) { | ||||||
|  |         my $err_log = "Can't get $URL -- " . $err; | ||||||
|  |         readingsSingleUpdate( $hash, "lastConnection", $err, 1 ); | ||||||
|         Log $hash, 1, "Error: $err_log"; |         Log $hash, 1, "Error: $err_log"; | ||||||
|         return "Error|Error " . $response->status_line; |         return "Error|Error " . $err; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     Log $hash, 4, length( $response->content ) . " characters captured"; |     Log $hash, 4, length($data) . " characters captured:  $data"; | ||||||
|     return $response->content; |     return $data; | ||||||
| } | } | ||||||
|  |  | ||||||
| ##################################### | ##################################### | ||||||
| @@ -3624,7 +3623,7 @@ sub UWZSearchAreaID($$) { | |||||||
|   ], |   ], | ||||||
|   "release_status": "stable", |   "release_status": "stable", | ||||||
|   "license": "GPL_2", |   "license": "GPL_2", | ||||||
|   "version": "v2.2.0", |   "version": "v2.2.1", | ||||||
|   "author": [ |   "author": [ | ||||||
|     "Marko Oldenburg <leongaultier@gmail.com>" |     "Marko Oldenburg <leongaultier@gmail.com>" | ||||||
|   ], |   ], | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user