Winner
Новичок
Здравствуйте друзья!
Пожалуйста, помогите решить проблему- устранить зависание при чтении и залогиться.
Вот фрагмент кода работы со сокетом:
Это первый запрос с POST логингом. Есть-ли в нем ошибка, потому, что если логиться через браузер то редирект отправляет на страницу http://doma.biz/dom/index.php а не http://doma.biz/ .
POST /login.php HTTP/1.1
Host: doma.com
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 150
Connection: close
Referer: http://doma.com/login.php
Cookie: PHPSESSID=s2sdf5erfdanfempu385rjmh73
Content-Type: application/x-www-form-urlencoded
Content-Length: 71
login=Owner&passwd=etoja&go=GO';
-----------------------------------------------------------------------------------------------
Это ответ с редиректом на http://doma.com/ .
HTTP/1.1 302 Found
Date: Fri, 10 Jun 2011 08:56:24 GMT
Server: Apache/2.2.3 (CentOS)
X-Powered-By: PHP/5.2.17
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Last-Modified: "Fri, 10 Jun 2011 08:56:24 GMT"
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Location: http://doma.com/
Content-Length: 0
Connection: close
Content-Type: text/html; charset=windows-1251
-----------------------------------------------------------------------------------------------
Запрос редиректной страницы http://doma.com/ здесь скрипт зависает при чтении со сокета.
GET / HTTP/1.1
Host: doma.com
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 150
Connection: close
Referer: http://doma.com/login.php
Cookie: PHPSESSID=s2sdf5erfdanfempu385rjmh73
Content-Type: text/html
-----------------------------------------------------------------------------------------------
Если логиться через браузер то редирект вместо http://doma.com/ отправляет на другую страницу- http://doma.com/dom/index.php.
HTTP/1.1 302 Found
Date: Thu, 09 Jun 2011 12:54:58 GMT
Server: Apache/2.2.3 (CentOS)
X-Powered-By: PHP/5.2.17
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Last-Modified: "Thu, 09 Jun 2011 12:54:58 GMT"
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Location: http://doma.com/dom/index.php
Content-Length: 0
Connection: close
Content-Type: text/html; charset=windows-1251
-----------------------------------------------------------------------------------------------
Пожалуйста, помогите решить проблему- устранить зависание при чтении и залогиться.
Вот фрагмент кода работы со сокетом:
PHP:
$eFputs =fputs($source_socket, $reqHead);
$headers_response ='';
$body_response ='';
$couFgets =0;
while(!$body_response && $couFgets<70000){
$headers_response =fgets($source_socket, 102400);
$body_response .=$headers_response;
$couFgets++;
}
while(!feof($source_socket)){
$body_response .= fread($source_socket, 1024);
}
POST /login.php HTTP/1.1
Host: doma.com
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 150
Connection: close
Referer: http://doma.com/login.php
Cookie: PHPSESSID=s2sdf5erfdanfempu385rjmh73
Content-Type: application/x-www-form-urlencoded
Content-Length: 71
login=Owner&passwd=etoja&go=GO';
-----------------------------------------------------------------------------------------------
Это ответ с редиректом на http://doma.com/ .
HTTP/1.1 302 Found
Date: Fri, 10 Jun 2011 08:56:24 GMT
Server: Apache/2.2.3 (CentOS)
X-Powered-By: PHP/5.2.17
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Last-Modified: "Fri, 10 Jun 2011 08:56:24 GMT"
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Location: http://doma.com/
Content-Length: 0
Connection: close
Content-Type: text/html; charset=windows-1251
-----------------------------------------------------------------------------------------------
Запрос редиректной страницы http://doma.com/ здесь скрипт зависает при чтении со сокета.
GET / HTTP/1.1
Host: doma.com
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 150
Connection: close
Referer: http://doma.com/login.php
Cookie: PHPSESSID=s2sdf5erfdanfempu385rjmh73
Content-Type: text/html
-----------------------------------------------------------------------------------------------
Если логиться через браузер то редирект вместо http://doma.com/ отправляет на другую страницу- http://doma.com/dom/index.php.
HTTP/1.1 302 Found
Date: Thu, 09 Jun 2011 12:54:58 GMT
Server: Apache/2.2.3 (CentOS)
X-Powered-By: PHP/5.2.17
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Last-Modified: "Thu, 09 Jun 2011 12:54:58 GMT"
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Location: http://doma.com/dom/index.php
Content-Length: 0
Connection: close
Content-Type: text/html; charset=windows-1251
-----------------------------------------------------------------------------------------------