Re: Can I use wildcard pattern matching in Libsoup server?





On Tue, Aug 31, 2021 at 11:30 AM Jens Georg <mail jensge org> wrote:
On Tue, 2021-08-31 at 11:22 +0100, Ashutosh Naik via libsoup-list
wrote:
> I am using libsoup to implement a HTTP server. I want to catch all
> wildcard patterns of the form -
> "/foo/*/bar/"
> in the URL but I dont know how to do this right now.
> How can I implement this using the Libsoup and GLib libraries?
> My current code is using:
> soup_server_add_handler (server, "/foo/*/bar/", NULL,
> server_callback,
>              unregister_callback, data);
>
> The above doesnt work if I try to catch the URL "/foo/abc/bar"
> Please let me know if this is possible in libsoup and what is the
> correct syntax to be passed to soup_server_add_handler()

I think you have to create a generic handler (either for "/" or for
"/foo") and then decide on the path that is passed into the callback
and otherwise 404 or whatever the appropriate status would be

Yes I can do that, but I was wondering if that's the only way and if there is any way that I can support wildcards of the form /foo/*bar/ in the current libsoup implementation ?
 


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