Does not work redirect to https post

0 votes
asked Jan 12 by PletnevDmitry (120 points)

Log:
2018-01-12 07:47:34.498 Opening log file.
2018-01-12 07:47:34.498 INFO FileLogWriter(1)[1] Info: Assembly: Rebex.Common 2017 R6.2 for .NET 4.0-4.7
2018-01-12 07:47:34.498 INFO FileLogWriter(1)[1] Info: Platform: Windows 6.1.7601 64-bit; CLR: 4.0.30319.42000
2018-01-12 07:47:34.568 INFO HttpRequest(1)[1] HTTP: Connecting to 'https://auth.mail.ru:443'...
2018-01-12 07:47:34.888 INFO HttpRequest(1)[1] TLS: State StateChange:Negotiating
2018-01-12 07:47:36.288 INFO HttpRequest(1)[1] TLS: Using TLS 1.2.
2018-01-12 07:47:36.538 INFO HttpRequest(1)[1] TLS: State StateChange:Secured
2018-01-12 07:47:36.538 INFO HttpRequest(1)[1] TLS: Connection secured using cipher: TLS 1.2, RSA with ephemeral Elliptic Curve Diffie-Hellman, AES with 128-bit key in GCM mode, AEAD
2018-01-12 07:47:36.548 INFO HttpRequest(1)[1] HTTP: Sending request: POST /cgi-bin/auth?from=splash
2018-01-12 07:47:36.598 INFO HttpRequest(1)[1] HTTP: Received response: 302 Found.
2018-01-12 07:47:36.648 INFO HttpRequest(1)[1] TLS: State StateChange:Closed

Programme:
VS 2012 15.5.3

Dim cr As New Rebex.Net.HttpRequestCreator With {.LogWriter = New Rebex.FileLogWriter("C:\temp\rebexlog.txt")}
cr.Settings.SslAcceptAllCertificates = True
Dim Req As Rebex.Net.HttpRequest
Req = cr.Create(strUrl)
Req.Method = WebRequestMethods.Http.Post
Req.AllowAutoRedirect = True
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(strPar)
Req.ContentLength = byteArray.Length
Using dataStream As Stream = Req.GetRequestStream()
dataStream.Write(byteArray, 0, byteArray.Length)
End Using
Using response As Rebex.Net.HttpResponse = CType(Req.GetResponse(), Rebex.Net.HttpResponse)
Dim sr As StreamReader = New StreamReader(response.GetResponseStream(), Encoding.UTF8)
strTemp = sr.ReadToEnd
End Using

Why does not it work?

1 Answer

0 votes
answered Jan 12 by Lukas Pokorny (94,710 points)
edited Apr 6 by Lukas Pokorny

This looks like a bug. Apparently, AllowAutoRedirect does not work properly with POST requests. We will fix this and send you a link to a hotfix soon.

Thanks for bringing this issue to our attention!

As a temporary workaround, you might handle the redirect yourself based on response.StatusCode and response.Headers("Location").

Update: This has been fixed in Rebex HTTPS 2018 R1.

...