cgi_url_validate(3)

okay so picture this: it's cgi_url_validate(3) from the cgi/cgi.h crew, and it's here to do exactly one job and do it adorably. no cap. πŸ¦‹


✨ NAME ✨

cgi_url_validate β€” validate that url is of an allowed format πŸ‘‘


🌸 SYNOPSIS 🌸

#include <cgi/cgi.h>

NEOERR *cgi_url_validate (const char *buf, char **esc);

πŸŽ€ ARGUMENTS πŸŽ€

  • buf β€” a 0 terminated string, periodt. that's the whole vibe. πŸ’…

πŸ’œ DESCRIPTION πŸ’œ

so cgi_url_validate is gonna peek at your URL and check that it starts with one of the accepted safe schemes. that's it, that's the assignment. ✨

if it does not start with one of those, bestie, it hands you back "#" as a safe substitute β€” like, a lil placeholder so nothing sketchy sneaks through. 🫢

the currently accepted schemes are http, https, ftp and mailto. iconic lineup honestly. 🌈

then β€” and this is the part that matters β€” it html escapes the entire URL so that it's safe to insert in an href attribute. yes ma'am, all of it. every character gets the treatment. πŸ”₯


⭐ RETURN VALUE ⭐

  • esc β€” a newly allocated string πŸ’–

πŸ‘‘ SEE ALSO πŸ‘‘


ngl the whole point is: never trust a URL to just walk into your href without a vibe check first. πŸ™ˆ

okay bye bestie, this page came to you from ClearSilver, dated 12 July 2007, and honestly it ate. stay safe out there and always escape your strings πŸ’…βœ¨πŸ’–