Re: TLS server-client in Pike
Siddhant Gupta <[email protected]>
| Newsgroups | gmane.comp.lang.pike.user |
|---|---|
| Message-ID | <CAB9YtyFWHO1tjFFeEEb-iQ5Bp8ngorHPtw_gxkrAk083kT9jGQ@mail.gmail.com> |
I changed my client to set it to blocking. I have updated the code on
github. I will post it here also for youe quick reference.
int main()
{
Stdio.FILE sock = Stdio.FILE();
if(!sock->connect("127.0.0.1", 443)){
write(strerror(sock->errno()));
}
SSL.context ctx = SSL.context();
SSL.sslfile ssl = SSL.sslfile(sock,ctx,1,1);
ssl->set_blocking();
// ssl->connect();
ssl->write("GET / HTTP/1.1\r\n\r\n");
string str = ssl->read(1024,1);
write("Response:\n%s\n",str);
return -1;
}
I am getting a response from the server but also an error message after
that.
Cannot use nonblocking IO with buffered files.
/usr/local/pike/7.8.866/lib/modules/Stdio.pmod/module.pmod:1955:
Stdio.FILE("socket", "127.0.0.1:443", 777 /* fd=10
*/)->set_nonblocking()
/usr/local/pike/7.8.866/lib/modules/SSL.pmod/sslfile.pike:755:
SSL.sslfile(Fd(10))->destroy()
Even though I have set it to blocking why am I getting this error.
On Thu, Jun 2, 2016 at 6:04 PM Henrik Grubbström <[email protected]> wrote:
> On Thu, 2 Jun 2016, Siddhant Gupta wrote:
>
> >
> https://github.com/Siddhant085/SSL_client_pike/blob/master/sslclient.pike
> > This is the github link to my code. I am a little confused as the SSL
> > module has changed from pike version 7.8.
> > The older version had SSL.ClientConnection and SSL.ServerConnection but
> the
> > newer versions don't have these classes
>
> You mean the other way around, right?
>
> In Pike 7.8 and earlier the client/server and blocking modes where set
> with argument 3 and 4 to SSL.sslfile()->create() respectively.
>
> /grubba
>
> --
> Henrik Grubbström [email protected]
> Roxen Internet Software AB