This gets the port string in the URL. If the port is not in the URL, it returns nullptr (and sets length to zeor). Note this is subtly different from TSUrlPortGet which always returns a valid port, the canonical port for the scheme if the port is not specified. Currently there is no way to detect this from a plugin.
char const* TSUrlPortGet(TSMBuffer, TSMLoc, int* length);