> -----Original Message-----

> I developed an SSL-enabled web server. I'm firing up SSL on incoming
> connections with SSL_accept().
> Now, if someone connects to my webserver not using SSL, but sending the
> "GET ..." without the SSL handshake, I get an SSL Error
> (error:1407609C:SSL routines:SSL23_GET_CLIENT_HELLO:http request), which
> is ok.
> What I would like to do now, is to send a HTTP Redirection response to
> the client, using the original URI and "Host" header from the HTTP
> request, but prepending a "https://";. Now I have the following problem:
> SSL_accept() "swallows" up the first characters of the URI which I need
> to put together my HTTP response.
>
> For example my client sends a request to the server:
> GET /admin.html HTTP/1.1
> Host: www.foo.bar:443
>
> SSL_accept swallows "GET /admin." until it recognizese that we have a
> protocol violation and returns the above error. When I continue reading
> from the socket, I only get "html HTTP/1.1\r\nHost:
> www.foo.bar:443\r\n\r\n". The "GET admin." is lost for my application
> and I cannot redirect to https://www.foo.bar:443/admin.html.
>
> Is there a way to get these characters back? Any help is appreciated!

There are right ways and there are easy ways. The easy way is to
non-destructively read the first character on the connection. If it is 'G'
or 'P', assume plaintext, if not, assume SSL and build (or don't build) an
SSL connection accordingly.

DS


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [email protected]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to