Code Duplication    Length = 21-21 lines in 2 locations

src/wp-includes/class-snoopy.php 2 locations

@@ 317-337 (lines=21) @@
314
315
					$this->_disconnect($fp);
316
317
					if($this->_redirectaddr)
318
					{
319
						/* url was redirected, check if we've hit the max depth */
320
						if($this->maxredirs > $this->_redirectdepth)
321
						{
322
							if(!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr))
323
								$this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]);
324
325
							// only follow redirect if it's on this site, or offsiteok is true
326
							if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok)
327
							{
328
								/* follow the redirect */
329
								$this->_redirectdepth++;
330
								$this->lastredirectaddr=$this->_redirectaddr;
331
								if( strpos( $this->_redirectaddr, "?" ) > 0 )
332
									$this->fetch($this->_redirectaddr); // the redirect has changed the request method from post to get
333
								else
334
									$this->submit($this->_redirectaddr,$formvars, $formfiles);
335
							}
336
						}
337
					}
338
339
					if($this->_framedepth < $this->maxframes && count($this->_frameurls) > 0)
340
					{
@@ 384-404 (lines=21) @@
381
					$this->_httpsrequest($path, $URI, $this->_submit_method, $this->_submit_type, $postdata);
382
				}
383
384
				if($this->_redirectaddr)
385
				{
386
					/* url was redirected, check if we've hit the max depth */
387
					if($this->maxredirs > $this->_redirectdepth)
388
					{
389
						if(!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr))
390
							$this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]);
391
392
						// only follow redirect if it's on this site, or offsiteok is true
393
						if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok)
394
						{
395
							/* follow the redirect */
396
							$this->_redirectdepth++;
397
							$this->lastredirectaddr=$this->_redirectaddr;
398
							if( strpos( $this->_redirectaddr, "?" ) > 0 )
399
								$this->fetch($this->_redirectaddr); // the redirect has changed the request method from post to get
400
							else
401
								$this->submit($this->_redirectaddr,$formvars, $formfiles);
402
						}
403
					}
404
				}
405
406
				if($this->_framedepth < $this->maxframes && count($this->_frameurls) > 0)
407
				{