---
name: "Ns_Url"
section: "3"
platform: "linux"
package: "aolserver4"
version: "4.0.10-7"
release: "Debian 4.0 (Etch)"
platforms: ["linux"]
url: "https://new.carta.tech/Ns_Url"
---

# Ns\_Url(3)

URL manipulation routines

```

```

## NAME

Ns\_AbsoluteUrl, Ns\_ParseUrl, Ns\_RelativeUrl, Ns\_SkipUrl - URL manipulation routines

## SYNOPSIS

```
#include "ns.h"

int
Ns_AbsoluteUrl(Ns_DString *pds, char *url, char *baseurl)

int
Ns_ParseUrl(char *url, char **pprotocol, char **phost,
            char **pport, char **ppath, char **ptail)

char *
Ns_RelativeUrl(char *url, char *location)

char *
Ns_SkipUrl(Ns_Request *request, int n)
```

## DESCRIPTION

- **Ns\_AbsoluteUrl**(*pds, url, baseurl*)

  Construct an URL based on baseurl but with as many parts of  the incomplete url as possible. Return NS\_OK or NS\_ERROR.

- **Ns\_ParseUrl**(*url, pprotocol, phost, pport, ppath, ptail*)

  Parse a URL into its component parts. Pointers to the protocol,  host, port, path, and "tail" (last path element) will be set  by reference in the passed-in pointers. The passed-in url will be modified.

- **Ns\_RelativeUrl**(*url, location*)

  If the url passed in is for this server, then the initial  part of the URL is stripped off. e.g., on a server whose  location is http://www.foo.com, Ns\_RelativeUrl of  "http://www.foo.com/hello" will return "/hello".  Returns a pointer to the beginning of the relative url in the  passed-in url, or NULL if error. Will set errno on error.

- **Ns\_SkipUrl**(*request, n*)

  Return a pointer n elements into the request's url.

## SEE ALSO

nsd(1), [info(n)](/info/n.md)

## KEYWORDS
