Added one line to discard from the top of the headers possible “HTTP/(version) 100 Continue” and the empty lines that may follow
This commit is contained in:
parent
7d931d097b
commit
53929b069e
1 changed files with 2 additions and 0 deletions
|
@ -78,6 +78,8 @@ function curl($url,$napid=null,$headers=null,$postdata=null,$conntimeout=null,$f
|
|||
$gheaders=substr($res,0,$gheaders_sz-4);// "-4" accounts for the 2 "\r\n" that separates headers from body
|
||||
// echo "{$gheaders}\n";
|
||||
$gheaders=explode("\r\n",$gheaders);
|
||||
// the line below is needed to discard from the top of the headers possible "HTTP/(version) 100 Continue" and the empty lines that may follow
|
||||
while (trim($gheaders[0])=='' || preg_match('#^HTTP/\d+\.\d+\s+100\s+#',$gheaders[0])===1) array_shift($gheaders);
|
||||
$res=substr($res,$gheaders_sz);
|
||||
$httpcode=preg_replace('#^\S+\s+(\d+).*$#','$1',$gheaders[0]);
|
||||
if (!is_null($napid)) {
|
||||
|
|
Loading…
Reference in a new issue