[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libmicrohttpd] How do I check if the request was done from HTTP or
From: |
Christian Grothoff |
Subject: |
Re: [libmicrohttpd] How do I check if the request was done from HTTP or HTTPS? |
Date: |
Wed, 24 Feb 2016 02:31:13 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.5.0 |
Hi!
Well, to run MHD with both HTTP and HTTPS-support, you need to start the
daemon twice. That means you can pass a different callback or a
different closure to distinguish. You could also try to get access to
the TLS/SSL handle via MHD_CONNECTION_INFO_GNUTLS_SESSION, which would
fail for HTTP and give you info you might want for HTTPS.
Happy hacking!
Christian
On 02/24/2016 01:51 AM, silvioprog wrote:
> Hello listers,
>
> Sometimes, we need to check if the client does a request from HTTP or
> HTTPS protocol, and then take a decision. In nginx I use it to redirect all
> requests from HTTP URL to the HTTPS URL.
>
> I took a look how NodeJS does it, because it has the `protocol` property on
> its request object:
>
> https://github.com/expressjs/express/blob/master/lib/request.js#L288
>
> Does anybody know if I can do something like this with MHD? I searched some
> function or flag, but I couldn't find that.
>
> Thank you!
>
signature.asc
Description: OpenPGP digital signature