При анализе снифером запросы и ответы при авторизации и при запуске из программы одинаковые.а авторизации не происходит.Что не так делаю.
Авторизация
POST /profile/sign_in HTTP/1.1
Host: rghost.ru
Connection: keep-alive
Content-Length: 240
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Origin: http://rghost.ru
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Referer: http://rghost.ru/users/Andrey5079/files
Accept-Encoding: gzip, deflate
Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4
Cookie: _rghost_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFVEkiJWQ1MDBmNzYzMzk0ODY2ODc0YzgxM2NhZTFjOTY4ODFlBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMUkvdGdwa3dlRjVvSTF6KzN1TFdVOFpJK0FnNzE4bDlnMXB5cnRnMCtkYVU9BjsARg%3D%3D--70f0640228e6328befa6bd5fc73a6152b5501fe3; _ga=GA1.2.1005775055.1443952704; _gat=1
utf8=%E2%9C%93&authenticity_token=I%2FtgpkweF5oI1z%2B3uLWU8ZI%2BAg718l9g1pyrtg0%2BdaU%3D&user%5Bemail%5D=Udokan68%40gmail.com&user%5Bpassword%5D=A14011968&user%5Bremember_me%5D=0&user%5Bremember_me%5D=1&commit=%D0%92%D0%BE%D0%B9%D1%82%D0%B8
Host: rghost.ru
Connection: keep-alive
Content-Length: 240
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Origin: http://rghost.ru
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Referer: http://rghost.ru/users/Andrey5079/files
Accept-Encoding: gzip, deflate
Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4
Cookie: _rghost_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFVEkiJWQ1MDBmNzYzMzk0ODY2ODc0YzgxM2NhZTFjOTY4ODFlBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMUkvdGdwa3dlRjVvSTF6KzN1TFdVOFpJK0FnNzE4bDlnMXB5cnRnMCtkYVU9BjsARg%3D%3D--70f0640228e6328befa6bd5fc73a6152b5501fe3; _ga=GA1.2.1005775055.1443952704; _gat=1
utf8=%E2%9C%93&authenticity_token=I%2FtgpkweF5oI1z%2B3uLWU8ZI%2BAg718l9g1pyrtg0%2BdaU%3D&user%5Bemail%5D=Udokan68%40gmail.com&user%5Bpassword%5D=A14011968&user%5Bremember_me%5D=0&user%5Bremember_me%5D=1&commit=%D0%92%D0%BE%D0%B9%D1%82%D0%B8
POST /profile/sign_in HTTP/1.1
Host: rghost.ru
Connection: keep-alive
Content-Length: 240
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Origin: http://rghost.ru
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Referer: http://rghost.ru/users/Andrey5079/files
Accept-Encoding: gzip, deflate
Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4
Cookie: _rghost_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFVEkiJWQ1MDBmNzYzMzk0ODY2ODc0YzgxM2NhZTFjOTY4ODFlBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMUkvdGdwa3dlRjVvSTF6KzN1TFdVOFpJK0FnNzE4bDlnMXB5cnRnMCtkYVU9BjsARg%3D%3D--70f0640228e6328befa6bd5fc73a6152b5501fe3; _ga=GA1.2.1005775055.1443952704; _gat=1
utf8=%E2%9C%93&authenticity_token=I%2FtgpkweF5oI1z%2B3uLWU8ZI%2BAg718l9g1pyrtg0%2BdaU%3D&user%5Bemail%5D=Udokan68%40gmail.com&user%5Bpassword%5D=A14011968&user%5Bremember_me%5D=0&user%5Bremember_me%5D=1&commit=%D0%92%D0%BE%D0%B9%D1%82%D0%B8
Host: rghost.ru
Connection: keep-alive
Content-Length: 240
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Origin: http://rghost.ru
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Referer: http://rghost.ru/users/Andrey5079/files
Accept-Encoding: gzip, deflate
Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4
Cookie: _rghost_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFVEkiJWQ1MDBmNzYzMzk0ODY2ODc0YzgxM2NhZTFjOTY4ODFlBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMUkvdGdwa3dlRjVvSTF6KzN1TFdVOFpJK0FnNzE4bDlnMXB5cnRnMCtkYVU9BjsARg%3D%3D--70f0640228e6328befa6bd5fc73a6152b5501fe3; _ga=GA1.2.1005775055.1443952704; _gat=1
utf8=%E2%9C%93&authenticity_token=I%2FtgpkweF5oI1z%2B3uLWU8ZI%2BAg718l9g1pyrtg0%2BdaU%3D&user%5Bemail%5D=Udokan68%40gmail.com&user%5Bpassword%5D=A14011968&user%5Bremember_me%5D=0&user%5Bremember_me%5D=1&commit=%D0%92%D0%BE%D0%B9%D1%82%D0%B8