Can I use wildcard pattern matching in Libsoup server?

44 views Asked by At

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()

1

There are 1 answers

0
ptomato On

soup_server_add_handler() doesn't take wildcards in its path. You will have to add a handler for / and then examine the path handled to see if it matches your wildcard expression.

There is a merge request that adds something like this to Soup, but it is stalled.