libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libmicrohttpd] Getting "raw URL" directly


From: Christian Grothoff
Subject: Re: [libmicrohttpd] Getting "raw URL" directly
Date: Thu, 17 Sep 2020 12:58:35 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0

You can get the full unparsed URL using the

MHD_OPTION_URI_LOG_CALLBACK

To do so, register this callback and it'll be the first thing you ever
see of any request.

Happy hacking!

Christian

On 9/17/20 12:32 PM, FERMIN GALAN MARQUEZ wrote:
> Hi,
> 
>  
> 
> I have a libmicrohttpd based server that processes requests like this one:
> 
>  
> 
> GET /v2/entities?type=T
> 
>  
> 
> For logging purpose I’d need the “raw URL” (I mean URL path plus query
> params, e.g “/v2/entities?type=T”). My callback entry point for requests
> is like this:
> 
>  
> 
> static int connectionTreat
> 
> (
> 
>    void*            cls,
> 
>    MHD_Connection*  connection,
> 
>    const char*      url,
> 
>    const char*      method,
> 
>    const char*      version,
> 
>    const char*      upload_data,
> 
>    size_t*          upload_data_size,
> 
>    void**           con_cls
> 
> )
> 
>  
> 
> but that “url” parameter only holds the “/v2/entities” part of the URL,
> the “?type=T” part is not included.
> 
>  
> 
> I know that I can parse the URL query params using
> MHD_get_connection_values() with MHD_GET_ARGUMENT_KIND and re-generate
> the query parameters string with that, but I would like to avoid such
> complexity if there is another simpler way of just getting the “raw” URL
> string.
> 
>  
> 
> Any help or feedback on this is really welcomed! Thanks in advance!
> 
>  
> 
> Best regards,
> 
>  
> 
> ------
> 
> Fermín
> 
> 
> ------------------------------------------------------------------------
> 
> Este mensaje y sus adjuntos se dirigen exclusivamente a su destinatario,
> puede contener información privilegiada o confidencial y es para uso
> exclusivo de la persona o entidad de destino. Si no es usted. el
> destinatario indicado, queda notificado de que la lectura, utilización,
> divulgación y/o copia sin autorización puede estar prohibida en virtud
> de la legislación vigente. Si ha recibido este mensaje por error, le
> rogamos que nos lo comunique inmediatamente por esta misma vía y proceda
> a su destrucción.
> 
> The information contained in this transmission is privileged and
> confidential information intended only for the use of the individual or
> entity named above. If the reader of this message is not the intended
> recipient, you are hereby notified that any dissemination, distribution
> or copying of this communication is strictly prohibited. If you have
> received this transmission in error, do not read it. Please immediately
> reply to the sender that you have received this communication in error
> and then delete it.
> 
> Esta mensagem e seus anexos se dirigem exclusivamente ao seu
> destinatário, pode conter informação privilegiada ou confidencial e é
> para uso exclusivo da pessoa ou entidade de destino. Se não é vossa
> senhoria o destinatário indicado, fica notificado de que a leitura,
> utilização, divulgação e/ou cópia sem autorização pode estar proibida em
> virtude da legislação vigente. Se recebeu esta mensagem por erro,
> rogamos-lhe que nos o comunique imediatamente por esta mesma via e
> proceda a sua destruição



reply via email to

[Prev in Thread] Current Thread [Next in Thread]