HTTP URL Percent Encoding

This chapter describes the HTTP URL Percent Encoding feature in ECS, and provides detailed information on the following topics:

Feature Description

Percent-encoding functionality is used whenever URL redirection happens for an HTTP Request packet and the requested URL (original URL) is embedded in redirected response. The reserved characters present in the requested URL are replaced by % followed by ASCII hexadecimal value. As defined in RFC 3986, a capability is added in the ECS to percent-encode reserved characters when modifying HTTP URLs. The percent (%) character is also percent-encoded as “%25” as this serves as the indicator for percent-encoded octets within a URL.

HTTP URL redirection can happen via Charging Action or DCCA. For redirection via DCCA, percent encoding is needed only when original URL is appended. URL append is supported only for dcca-custom1 and dcca-custom24 dictionaries. When original URL is embedded in the redirected URL string for HTTP URL redirection, all reserved characters in the original URL are now percent-encoded when redirection is triggered via charging action or DCCA.

In case of HTTP URL redirection, when original URL is embedded in the redirected URL string:

  • All reserved characters in the original URL (per RFC 3986) are percent-encoded in case redirection is triggered via charging-action.

  • All reserved characters in the original URL (per RFC 3986) are percent-encoded in case redirection is triggered via DCCA.

  • The % character, if present in the original URL is percent-encoded to %25.

  • In case the original URL was concatenated with other information, then all reserved characters and % character are percent-encoded if redirection is triggered via charging-action.

The following table lists the reserved characters used for percent encoding and supported as per RFC 3986.

Table 1. Reserved Characters per RFC 3986

Reserved Character

ASCII Value

Percent Encode Format (Hex)

Support for Charging-action based Redirect

Support for DCCA based Redirect

:

58

%3A

Yes

Yes

/

47

%2F

Yes

Yes

?

63

%3F

Yes

Yes

#

35

%23

Yes

Yes

=

61

%3D

Yes

No

&

38

%26

Yes

No

+

43

%2B

Yes

No

@

64

%40

No

No

!

33

%21

No

No

$

36

%24

No

No

'

46

%2E

No

No

(

40

%28

No

No

)

41

%29

No

No

*

42

%2A

No

No

,

44

%2C

No

No

;

59

%3B

No

No

[

91

%5B

No

No

]

93

%5D

No

No

How it Works

Percent Encoding of HTTP URL

Consider the following sample configuration used for URL redirection. The directive #HTTP.URL# will embed the original requested URL into the redirected URL string and the embedded URL will be percent-encoded.

flow action redirect-url http://www.cisco.com=#HTTP.URL# 

Where the value of original URL (HTTP.URL) is as follows:

HTTP.URL => mailcisco:/?#=&+@!$'()*,;[] 

The percent encoded URL will be:

mailcisco%3A%2F%3F%23%3D%26%2B%40%21%24%2E%28%29%2A%2C%3B%5B%5D 

The complete redirected URL in HTTP redirection response will be:

http://www.cisco.com=mailcisco%3A%2F%3F%23%3D%26%2B%40%21%24%2E%28%29%2A%2C%3B%5B%5D 

DCCA Dictionaries

For URL redirection via DCCA, percent encoding is required only when original URL is appended. This URL append is supported for dcca-custom1 and dcca-custom24 customer-specific dictionaries.

URL Append Message from OCS for dcca-custom1

For dcca-custom1 dictionary, the URL-Append flag must be set so that the requested URL will be embedded in the redirect response.

[M] Final-Unit-Action: REDIRECT (1) 
   [M] Redirect-Server: 
      [M] Redirect-Address-Type: URL (2) 
      [M] Redirect-Server-Address: <redirect-url-address> 
   [V] [M] URL-Append: APPEND_URL (1) 

URL Append Message from OCS for dcca-custom24

For dcca-custom24 dictionary, although URL-Append flag is not set, the ? character at the end of redirect-url-address string indicates that the requested URL will be embedded in the redirect response.

[M] Final-Unit-Action: REDIRECT (1) 
   [M] Redirect-Server: 
      [M] Redirect-Address-Type: URL (2) 
      [M] Redirect-Server-Address: <redirect-url-address>? 
   [V] [M] URL-Append: DO_NOT_APPEND_URL (0) 

Standards Compliance

The HTTP URL Encoding feature complies with RFC 3986 — Uniform Resource Identifier (URI): Generic Syntax.

Configuring URL Redirection via Charging Action

The following configuration command is used to configure URL redirection via charging action.

config 
   active-charging service service_name 
      charging-action charging_action_name 
         flow action redirect url url_string 
         exit 

Notes:

url_string specifies the redirect URL and must be an alphanumeric string of 1 through 511 characters. It may include one or more dynamic fields (up to 16 may be specified). Dynamic fields must be enclosed in “#” (hash).

For example: http://www.cisco.com=#HTTP.URL#