re77.html 60 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <title>&lt;GUri&gt;: </title>
  6. <meta name="generator" content="DocBook XSL Stylesheets V1.79.2">
  7. <link rel="home" href="index.html" title="">
  8. <link rel="up" href="ch01.html" title="GLib">
  9. <link rel="prev" href="re76.html" title="&lt;%GLibUnicodeType&gt;">
  10. <link rel="next" href="re78.html" title="&lt;%GLibUriError&gt;">
  11. <meta name="generator" content="GTK-Doc V1.33.1 (XML mode)">
  12. <link rel="stylesheet" href="style.css" type="text/css">
  13. </head>
  14. <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
  15. <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
  16. <td width="100%" align="left" class="shortcuts"></td>
  17. <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
  18. <td><img src="up-insensitive.png" width="16" height="16" border="0"></td>
  19. <td><a accesskey="p" href="re76.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
  20. <td><a accesskey="n" href="re78.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
  21. </tr></table>
  22. <div class="refentry">
  23. <a name="id-1.1.78"></a><div class="titlepage"></div>
  24. <div class="refnamediv">
  25. <h2>&lt;GUri&gt;</h2>
  26. <p>&lt;GUri&gt;</p>
  27. </div>
  28. <div class="refsect1">
  29. <a name="id-1.1.78.2"></a><h2>Description</h2>
  30. <p>The <span class="type">GUri</span> type and related functions can be used to parse URIs into
  31. their components, and build valid URIs from individual components.
  32. </p>
  33. <p>Note that <span class="type">GUri</span> scope is to help manipulate URIs in various applications,
  34. following [RFC 3986](https://tools.ietf.org/html/rfc3986). In particular,
  35. it doesn't intend to cover web browser needs, and doesn't implement the
  36. [WHATWG URL](https://url.spec.whatwg.org/) standard. No APIs are provided to
  37. help prevent
  38. [homograph attacks](https://en.wikipedia.org/wiki/IDN_homograph_attack), so
  39. <span class="type">GUri</span> is not suitable for formatting URIs for display to the user for making
  40. security-sensitive decisions.
  41. </p>
  42. <div class="refsect2">
  43. <a name="id-1.1.78.2.4"></a><h3>Relative and absolute URIs <a name="relative-absolute-uris"></a>
  44. </h3>
  45. <p>As defined in [RFC 3986](https://tools.ietf.org/html/rfc3986#section-4), the
  46. hierarchical nature of URIs means that they can either be ‘relative
  47. references’ (sometimes referred to as ‘relative URIs’) or ‘URIs’ (for
  48. clarity, ‘URIs’ are referred to in this documentation as
  49. ‘absolute URIs’ — although
  50. [in constrast to RFC 3986](https://tools.ietf.org/html/rfc3986#section-4.3),
  51. fragment identifiers are always allowed).
  52. </p>
  53. <p>Relative references have one or more components of the URI missing. In
  54. particular, they have no scheme. Any other component, such as hostname,
  55. query, etc. may be missing, apart from a path, which has to be specified (but
  56. may be empty). The path may be relative, starting with <code class="code">./</code> rather than <code class="code">/</code>.
  57. </p>
  58. <p>For example, a valid relative reference is <code class="code">./path?query</code>,
  59. <code class="code">/?query#fragment</code> or <code class="code">//example.com</code>.
  60. </p>
  61. <p>Absolute URIs have a scheme specified. Any other components of the URI which
  62. are missing are specified as explicitly unset in the URI, rather than being
  63. resolved relative to a base URI using <code class="function">g_uri_parse_relative()</code>.
  64. </p>
  65. <p>For example, a valid absolute URI is <code class="code">file:///home/bob</code> or
  66. <code class="code">https://search.com?query=string</code>.
  67. </p>
  68. <p>A <span class="type">GUri</span> instance is always an absolute URI. A string may be an absolute URI
  69. or a relative reference; see the documentation for individual functions as to
  70. what forms they accept.
  71. </p>
  72. </div>
  73. <div class="refsect2">
  74. <a name="id-1.1.78.2.5"></a><h3>Parsing URIs</h3>
  75. <p>The most minimalist APIs for parsing URIs are <code class="function">g_uri_split()</code> and
  76. <code class="function">g_uri_split_with_user()</code>. These split a URI into its component
  77. parts, and return the parts; the difference between the two is that
  78. <code class="function">g_uri_split()</code> treats the ‘userinfo’ component of the URI as a
  79. single element, while <code class="function">g_uri_split_with_user()</code> can (depending on the
  80. <span class="type">GUriFlags</span> you pass) treat it as containing a username, password,
  81. and authentication parameters. Alternatively, <code class="function">g_uri_split_network()</code>
  82. can be used when you are only interested in the components that are
  83. needed to initiate a network connection to the service (scheme,
  84. host, and port).
  85. </p>
  86. <p><code class="function">g_uri_parse()</code> is similar to <code class="function">g_uri_split()</code>, but instead of returning
  87. individual strings, it returns a <span class="type">GUri</span> structure (and it requires
  88. that the URI be an absolute URI).
  89. </p>
  90. <p><code class="function">g_uri_resolve_relative()</code> and <code class="function">g_uri_parse_relative()</code> allow you to
  91. resolve a relative URI relative to a base URI.
  92. <code class="function">g_uri_resolve_relative()</code> takes two strings and returns a string,
  93. and <code class="function">g_uri_parse_relative()</code> takes a <span class="type">GUri</span> and a string and returns a
  94. <span class="type">GUri</span>.
  95. </p>
  96. <p>All of the parsing functions take a <span class="type">GUriFlags</span> argument describing
  97. exactly how to parse the URI; see the documentation for that type
  98. for more details on the specific flags that you can pass. If you
  99. need to choose different flags based on the type of URI, you can
  100. use <code class="function">g_uri_peek_scheme()</code> on the URI string to check the scheme
  101. first, and use that to decide what flags to parse it with.
  102. </p>
  103. <p>For example, you might want to use <code class="constant">G_URI_PARAMS_WWW_FORM</code> when parsing the
  104. params for a web URI, so compare the result of <code class="function">g_uri_peek_scheme()</code> against
  105. <code class="code">http</code> and <code class="code">https</code>.
  106. </p>
  107. </div>
  108. <div class="refsect2">
  109. <a name="id-1.1.78.2.6"></a><h3>Building URIs</h3>
  110. <p><code class="function">g_uri_join()</code> and <code class="function">g_uri_join_with_user()</code> can be used to construct
  111. valid URI strings from a set of component strings. They are the
  112. inverse of <code class="function">g_uri_split()</code> and <code class="function">g_uri_split_with_user()</code>.
  113. </p>
  114. <p>Similarly, <code class="function">g_uri_build()</code> and <code class="function">g_uri_build_with_user()</code> can be used to
  115. construct a <span class="type">GUri</span> from a set of component strings.
  116. </p>
  117. <p>As with the parsing functions, the building functions take a
  118. <span class="type">GUriFlags</span> argument. In particular, it is important to keep in mind
  119. whether the URI components you are using are already <code class="code">%</code>-encoded. If so,
  120. you must pass the <code class="constant">G_URI_FLAGS_ENCODED</code> flag.
  121. </p>
  122. </div>
  123. <div class="refsect2">
  124. <a name="id-1.1.78.2.7"></a><h3>`file://` URIs</h3>
  125. <p>Note that Windows and Unix both define special rules for parsing
  126. <code class="code">file://</code> URIs (involving non-UTF-8 character sets on Unix, and the
  127. interpretation of path separators on Windows). <span class="type">GUri</span> does not
  128. implement these rules. Use <code class="function">g_filename_from_uri()</code> and
  129. <code class="function">g_filename_to_uri()</code> if you want to properly convert between
  130. <code class="code">file://</code> URIs and local filenames.
  131. </p>
  132. </div>
  133. <div class="refsect2">
  134. <a name="id-1.1.78.2.8"></a><h3>URI Equality</h3>
  135. <p>Note that there is no <code class="code">g_uri_equal ()</code> function, because comparing
  136. URIs usefully requires scheme-specific knowledge that <span class="type">GUri</span> does
  137. not have. For example, <code class="code">http://example.com/</code> and
  138. <code class="code">http://EXAMPLE.COM:80</code> have exactly the same meaning according
  139. to the HTTP specification, and <code class="code">data:,foo</code> and
  140. <code class="code">data:;base64,Zm9v</code> resolve to the same thing according to the
  141. <code class="code">data:</code> URI specification.</p>
  142. </div>
  143. </div>
  144. <div class="refsect1">
  145. <a name="id-1.1.78.3"></a><h2>Functions</h2>
  146. <div class="refsect2">
  147. <a name="id-1.1.78.3.2"></a><h3>get-auth-params</h3>
  148. <div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:get-auth-params self))
  149. </pre></div>
  150. <p>Gets <em class="parameter"><code>uri</code></em>'s authentication parameters, which may contain
  151. <code class="code">%</code>-encoding, depending on the flags with which <em class="parameter"><code>uri</code></em> was created.
  152. (If <em class="parameter"><code>uri</code></em> was not created with <code class="constant">G_URI_FLAGS_HAS_AUTH_PARAMS</code> then this will
  153. be <code class="constant">NULL</code>.)
  154. </p>
  155. <p>Depending on the URI scheme, <code class="function">g_uri_parse_params()</code> may be useful for
  156. further parsing this information.</p>
  157. <div class="refsect3">
  158. <a name="id-1.1.78.3.2.5"></a><h4>Parameters</h4>
  159. <div class="informaltable"><table><tr>
  160. <td class="parameter_name"><p>uri</p></td>
  161. <td class="parameter_description">
  162. <p>a <span class="type">GUri</span></p>
  163. <p>Passed as <code class="code">self</code></p>
  164. </td>
  165. </tr></table></div>
  166. </div>
  167. </div>
  168. <div class="refsect2">
  169. <a name="id-1.1.78.3.3"></a><h3>get-flags</h3>
  170. <div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:get-flags self))
  171. </pre></div>
  172. <p>Gets <em class="parameter"><code>uri</code></em>'s flags set upon construction.</p>
  173. <div class="refsect3">
  174. <a name="id-1.1.78.3.3.4"></a><h4>Parameters</h4>
  175. <div class="informaltable"><table><tr>
  176. <td class="parameter_name"><p>uri</p></td>
  177. <td class="parameter_description">
  178. <p>a <span class="type">GUri</span></p>
  179. <p>Passed as <code class="code">self</code></p>
  180. </td>
  181. </tr></table></div>
  182. </div>
  183. </div>
  184. <div class="refsect2">
  185. <a name="id-1.1.78.3.4"></a><h3>get-fragment</h3>
  186. <div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:get-fragment self))
  187. </pre></div>
  188. <p>Gets <em class="parameter"><code>uri</code></em>'s fragment, which may contain <code class="code">%</code>-encoding, depending on
  189. the flags with which <em class="parameter"><code>uri</code></em> was created.</p>
  190. <div class="refsect3">
  191. <a name="id-1.1.78.3.4.4"></a><h4>Parameters</h4>
  192. <div class="informaltable"><table><tr>
  193. <td class="parameter_name"><p>uri</p></td>
  194. <td class="parameter_description">
  195. <p>a <span class="type">GUri</span></p>
  196. <p>Passed as <code class="code">self</code></p>
  197. </td>
  198. </tr></table></div>
  199. </div>
  200. </div>
  201. <div class="refsect2">
  202. <a name="id-1.1.78.3.5"></a><h3>get-host</h3>
  203. <div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:get-host self))
  204. </pre></div>
  205. <p>Gets <em class="parameter"><code>uri</code></em>'s host. This will never have <code class="code">%</code>-encoded characters,
  206. unless it is non-UTF-8 (which can only be the case if <em class="parameter"><code>uri</code></em> was
  207. created with <code class="constant">G_URI_FLAGS_NON_DNS</code>).
  208. </p>
  209. <p>If <em class="parameter"><code>uri</code></em> contained an IPv6 address literal, this value will be just
  210. that address, without the brackets around it that are necessary in
  211. the string form of the URI. Note that in this case there may also
  212. be a scope ID attached to the address. Eg, <code class="code">fe80::1234%</code><code class="code">em1</code> (or
  213. <code class="code">fe80::1234%</code><code class="code">25em1</code> if the string is still encoded).</p>
  214. <div class="refsect3">
  215. <a name="id-1.1.78.3.5.5"></a><h4>Parameters</h4>
  216. <div class="informaltable"><table><tr>
  217. <td class="parameter_name"><p>uri</p></td>
  218. <td class="parameter_description">
  219. <p>a <span class="type">GUri</span></p>
  220. <p>Passed as <code class="code">self</code></p>
  221. </td>
  222. </tr></table></div>
  223. </div>
  224. </div>
  225. <div class="refsect2">
  226. <a name="id-1.1.78.3.6"></a><h3>get-password</h3>
  227. <div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:get-password self))
  228. </pre></div>
  229. <p>Gets <em class="parameter"><code>uri</code></em>'s password, which may contain <code class="code">%</code>-encoding, depending on
  230. the flags with which <em class="parameter"><code>uri</code></em> was created. (If <em class="parameter"><code>uri</code></em> was not created
  231. with <code class="constant">G_URI_FLAGS_HAS_PASSWORD</code> then this will be <code class="constant">NULL</code>.)</p>
  232. <div class="refsect3">
  233. <a name="id-1.1.78.3.6.4"></a><h4>Parameters</h4>
  234. <div class="informaltable"><table><tr>
  235. <td class="parameter_name"><p>uri</p></td>
  236. <td class="parameter_description">
  237. <p>a <span class="type">GUri</span></p>
  238. <p>Passed as <code class="code">self</code></p>
  239. </td>
  240. </tr></table></div>
  241. </div>
  242. </div>
  243. <div class="refsect2">
  244. <a name="id-1.1.78.3.7"></a><h3>get-path</h3>
  245. <div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:get-path self))
  246. </pre></div>
  247. <p>Gets <em class="parameter"><code>uri</code></em>'s path, which may contain <code class="code">%</code>-encoding, depending on the
  248. flags with which <em class="parameter"><code>uri</code></em> was created.</p>
  249. <div class="refsect3">
  250. <a name="id-1.1.78.3.7.4"></a><h4>Parameters</h4>
  251. <div class="informaltable"><table><tr>
  252. <td class="parameter_name"><p>uri</p></td>
  253. <td class="parameter_description">
  254. <p>a <span class="type">GUri</span></p>
  255. <p>Passed as <code class="code">self</code></p>
  256. </td>
  257. </tr></table></div>
  258. </div>
  259. </div>
  260. <div class="refsect2">
  261. <a name="id-1.1.78.3.8"></a><h3>get-port</h3>
  262. <div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:get-port self))
  263. </pre></div>
  264. <p>Gets <em class="parameter"><code>uri</code></em>'s port.</p>
  265. <div class="refsect3">
  266. <a name="id-1.1.78.3.8.4"></a><h4>Parameters</h4>
  267. <div class="informaltable"><table><tr>
  268. <td class="parameter_name"><p>uri</p></td>
  269. <td class="parameter_description">
  270. <p>a <span class="type">GUri</span></p>
  271. <p>Passed as <code class="code">self</code></p>
  272. </td>
  273. </tr></table></div>
  274. </div>
  275. </div>
  276. <div class="refsect2">
  277. <a name="id-1.1.78.3.9"></a><h3>get-query</h3>
  278. <div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:get-query self))
  279. </pre></div>
  280. <p>Gets <em class="parameter"><code>uri</code></em>'s query, which may contain <code class="code">%</code>-encoding, depending on the
  281. flags with which <em class="parameter"><code>uri</code></em> was created.
  282. </p>
  283. <p>For queries consisting of a series of <code class="code">name=value</code> parameters,
  284. <span class="type">GUriParamsIter</span> or <code class="function">g_uri_parse_params()</code> may be useful.</p>
  285. <div class="refsect3">
  286. <a name="id-1.1.78.3.9.5"></a><h4>Parameters</h4>
  287. <div class="informaltable"><table><tr>
  288. <td class="parameter_name"><p>uri</p></td>
  289. <td class="parameter_description">
  290. <p>a <span class="type">GUri</span></p>
  291. <p>Passed as <code class="code">self</code></p>
  292. </td>
  293. </tr></table></div>
  294. </div>
  295. </div>
  296. <div class="refsect2">
  297. <a name="id-1.1.78.3.10"></a><h3>get-scheme</h3>
  298. <div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:get-scheme self))
  299. </pre></div>
  300. <p>Gets <em class="parameter"><code>uri</code></em>'s scheme. Note that this will always be all-lowercase,
  301. regardless of the string or strings that <em class="parameter"><code>uri</code></em> was created from.</p>
  302. <div class="refsect3">
  303. <a name="id-1.1.78.3.10.4"></a><h4>Parameters</h4>
  304. <div class="informaltable"><table><tr>
  305. <td class="parameter_name"><p>uri</p></td>
  306. <td class="parameter_description">
  307. <p>a <span class="type">GUri</span></p>
  308. <p>Passed as <code class="code">self</code></p>
  309. </td>
  310. </tr></table></div>
  311. </div>
  312. </div>
  313. <div class="refsect2">
  314. <a name="id-1.1.78.3.11"></a><h3>get-user</h3>
  315. <div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:get-user self))
  316. </pre></div>
  317. <p>Gets the ‘username’ component of <em class="parameter"><code>uri</code></em>'s userinfo, which may contain
  318. <code class="code">%</code>-encoding, depending on the flags with which <em class="parameter"><code>uri</code></em> was created.
  319. If <em class="parameter"><code>uri</code></em> was not created with <code class="constant">G_URI_FLAGS_HAS_PASSWORD</code> or
  320. <code class="constant">G_URI_FLAGS_HAS_AUTH_PARAMS</code>, this is the same as <code class="function">g_uri_get_userinfo()</code>.</p>
  321. <div class="refsect3">
  322. <a name="id-1.1.78.3.11.4"></a><h4>Parameters</h4>
  323. <div class="informaltable"><table><tr>
  324. <td class="parameter_name"><p>uri</p></td>
  325. <td class="parameter_description">
  326. <p>a <span class="type">GUri</span></p>
  327. <p>Passed as <code class="code">self</code></p>
  328. </td>
  329. </tr></table></div>
  330. </div>
  331. </div>
  332. <div class="refsect2">
  333. <a name="id-1.1.78.3.12"></a><h3>get-userinfo</h3>
  334. <div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:get-userinfo self))
  335. </pre></div>
  336. <p>Gets <em class="parameter"><code>uri</code></em>'s userinfo, which may contain <code class="code">%</code>-encoding, depending on
  337. the flags with which <em class="parameter"><code>uri</code></em> was created.</p>
  338. <div class="refsect3">
  339. <a name="id-1.1.78.3.12.4"></a><h4>Parameters</h4>
  340. <div class="informaltable"><table><tr>
  341. <td class="parameter_name"><p>uri</p></td>
  342. <td class="parameter_description">
  343. <p>a <span class="type">GUri</span></p>
  344. <p>Passed as <code class="code">self</code></p>
  345. </td>
  346. </tr></table></div>
  347. </div>
  348. </div>
  349. <div class="refsect2">
  350. <a name="id-1.1.78.3.13"></a><h3>parse-relative</h3>
  351. <div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:parse-relative self uri-ref flags))
  352. </pre></div>
  353. <p>Parses <em class="parameter"><code>uri_ref</code></em> according to <em class="parameter"><code>flags</code></em> and, if it is a
  354. [relative URI][relative-absolute-uris], resolves it relative to <em class="parameter"><code>base_uri</code></em>.
  355. If the result is not a valid absolute URI, it will be discarded, and an error
  356. returned.</p>
  357. <div class="refsect3">
  358. <a name="id-1.1.78.3.13.4"></a><h4>Parameters</h4>
  359. <div class="informaltable"><table>
  360. <tr>
  361. <td class="parameter_name"><p>base_uri</p></td>
  362. <td class="parameter_description">
  363. <p>a base absolute URI</p>
  364. <p>Passed as <code class="code">self</code></p>
  365. </td>
  366. </tr>
  367. <tr>
  368. <td class="parameter_name"><p>uri_ref</p></td>
  369. <td class="parameter_description">
  370. <p>a string representing a relative or absolute URI</p>
  371. <p>Passed as <code class="code">uri-ref</code></p>
  372. </td>
  373. </tr>
  374. <tr>
  375. <td class="parameter_name"><p>flags</p></td>
  376. <td class="parameter_description">
  377. <p>flags describing how to parse <em class="parameter"><code>uri_ref</code></em></p>
  378. <p>Passed as <code class="code">flags</code></p>
  379. </td>
  380. </tr>
  381. </table></div>
  382. </div>
  383. </div>
  384. <div class="refsect2">
  385. <a name="id-1.1.78.3.14"></a><h3>to-string</h3>
  386. <div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:to-string self))
  387. </pre></div>
  388. <p>Returns a string representing <em class="parameter"><code>uri</code></em>.
  389. </p>
  390. <p>This is not guaranteed to return a string which is identical to the
  391. string that <em class="parameter"><code>uri</code></em> was parsed from. However, if the source URI was
  392. syntactically correct (according to RFC 3986), and it was parsed
  393. with <code class="constant">G_URI_FLAGS_ENCODED</code>, then <code class="function">g_uri_to_string()</code> is guaranteed to return
  394. a string which is at least semantically equivalent to the source
  395. URI (according to RFC 3986).
  396. </p>
  397. <p>If <em class="parameter"><code>uri</code></em> might contain sensitive details, such as authentication parameters,
  398. or private data in its query string, and the returned string is going to be
  399. logged, then consider using <code class="function">g_uri_to_string_partial()</code> to redact parts.</p>
  400. <div class="refsect3">
  401. <a name="id-1.1.78.3.14.6"></a><h4>Parameters</h4>
  402. <div class="informaltable"><table><tr>
  403. <td class="parameter_name"><p>uri</p></td>
  404. <td class="parameter_description">
  405. <p>a <span class="type">GUri</span></p>
  406. <p>Passed as <code class="code">self</code></p>
  407. </td>
  408. </tr></table></div>
  409. </div>
  410. </div>
  411. <div class="refsect2">
  412. <a name="id-1.1.78.3.15"></a><h3>to-string-partial</h3>
  413. <div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:to-string-partial self flags))
  414. </pre></div>
  415. <p>Returns a string representing <em class="parameter"><code>uri</code></em>, subject to the options in
  416. <em class="parameter"><code>flags</code></em>. See <code class="function">g_uri_to_string()</code> and <span class="type">GUriHideFlags</span> for more details.</p>
  417. <div class="refsect3">
  418. <a name="id-1.1.78.3.15.4"></a><h4>Parameters</h4>
  419. <div class="informaltable"><table>
  420. <tr>
  421. <td class="parameter_name"><p>uri</p></td>
  422. <td class="parameter_description">
  423. <p>a <span class="type">GUri</span></p>
  424. <p>Passed as <code class="code">self</code></p>
  425. </td>
  426. </tr>
  427. <tr>
  428. <td class="parameter_name"><p>flags</p></td>
  429. <td class="parameter_description">
  430. <p>flags describing what parts of <em class="parameter"><code>uri</code></em> to hide</p>
  431. <p>Passed as <code class="code">flags</code></p>
  432. </td>
  433. </tr>
  434. </table></div>
  435. </div>
  436. </div>
  437. <div class="refsect2">
  438. <a name="id-1.1.78.3.16"></a><h3>uri:build</h3>
  439. <div class="informalexample"><pre class="programlisting">(define-values
  440. (%return)
  441. (uri:build flags scheme userinfo host port path query fragment))
  442. </pre></div>
  443. <p>Creates a new <span class="type">GUri</span> from the given components according to <em class="parameter"><code>flags</code></em>.
  444. </p>
  445. <p>See also <code class="function">g_uri_build_with_user()</code>, which allows specifying the
  446. components of the "userinfo" separately.</p>
  447. <div class="refsect3">
  448. <a name="id-1.1.78.3.16.5"></a><h4>Parameters</h4>
  449. <div class="informaltable"><table>
  450. <tr>
  451. <td class="parameter_name"><p>flags</p></td>
  452. <td class="parameter_description">
  453. <p>flags describing how to build the <span class="type">GUri</span></p>
  454. <p>Passed as <code class="code">flags</code></p>
  455. </td>
  456. </tr>
  457. <tr>
  458. <td class="parameter_name"><p>scheme</p></td>
  459. <td class="parameter_description">
  460. <p>the URI scheme</p>
  461. <p>Passed as <code class="code">scheme</code></p>
  462. </td>
  463. </tr>
  464. <tr>
  465. <td class="parameter_name"><p>userinfo</p></td>
  466. <td class="parameter_description">
  467. <p>the userinfo component, or <code class="constant">NULL</code></p>
  468. <p>Passed as <code class="code">userinfo</code></p>
  469. </td>
  470. </tr>
  471. <tr>
  472. <td class="parameter_name"><p>host</p></td>
  473. <td class="parameter_description">
  474. <p>the host component, or <code class="constant">NULL</code></p>
  475. <p>Passed as <code class="code">host</code></p>
  476. </td>
  477. </tr>
  478. <tr>
  479. <td class="parameter_name"><p>port</p></td>
  480. <td class="parameter_description">
  481. <p>the port, or <code class="code">-1</code></p>
  482. <p>Passed as <code class="code">port</code></p>
  483. </td>
  484. </tr>
  485. <tr>
  486. <td class="parameter_name"><p>path</p></td>
  487. <td class="parameter_description">
  488. <p>the path component</p>
  489. <p>Passed as <code class="code">path</code></p>
  490. </td>
  491. </tr>
  492. <tr>
  493. <td class="parameter_name"><p>query</p></td>
  494. <td class="parameter_description">
  495. <p>the query component, or <code class="constant">NULL</code></p>
  496. <p>Passed as <code class="code">query</code></p>
  497. </td>
  498. </tr>
  499. <tr>
  500. <td class="parameter_name"><p>fragment</p></td>
  501. <td class="parameter_description">
  502. <p>the fragment, or <code class="constant">NULL</code></p>
  503. <p>Passed as <code class="code">fragment</code></p>
  504. </td>
  505. </tr>
  506. </table></div>
  507. </div>
  508. </div>
  509. <div class="refsect2">
  510. <a name="id-1.1.78.3.17"></a><h3>uri:build-with-user</h3>
  511. <div class="informalexample"><pre class="programlisting">(define-values
  512. (%return)
  513. (uri:build-with-user
  514. flags
  515. scheme
  516. user
  517. password
  518. auth-params
  519. host
  520. port
  521. path
  522. query
  523. fragment))
  524. </pre></div>
  525. <p>Creates a new <span class="type">GUri</span> from the given components according to <em class="parameter"><code>flags</code></em>
  526. (<code class="constant">G_URI_FLAGS_HAS_PASSWORD</code> is added unconditionally). The <em class="parameter"><code>flags</code></em> must be
  527. coherent with the passed values, in particular use <code class="code">%</code>-encoded values with
  528. <code class="constant">G_URI_FLAGS_ENCODED</code>.
  529. </p>
  530. <p>In contrast to <code class="function">g_uri_build()</code>, this allows specifying the components
  531. of the ‘userinfo’ field separately. Note that <em class="parameter"><code>user</code></em> must be non-<code class="constant">NULL</code>
  532. if either <em class="parameter"><code>password</code></em> or <em class="parameter"><code>auth_params</code></em> is non-<code class="constant">NULL</code>.</p>
  533. <div class="refsect3">
  534. <a name="id-1.1.78.3.17.5"></a><h4>Parameters</h4>
  535. <div class="informaltable"><table>
  536. <tr>
  537. <td class="parameter_name"><p>flags</p></td>
  538. <td class="parameter_description">
  539. <p>flags describing how to build the <span class="type">GUri</span></p>
  540. <p>Passed as <code class="code">flags</code></p>
  541. </td>
  542. </tr>
  543. <tr>
  544. <td class="parameter_name"><p>scheme</p></td>
  545. <td class="parameter_description">
  546. <p>the URI scheme</p>
  547. <p>Passed as <code class="code">scheme</code></p>
  548. </td>
  549. </tr>
  550. <tr>
  551. <td class="parameter_name"><p>user</p></td>
  552. <td class="parameter_description">
  553. <p>the user component of the userinfo, or <code class="constant">NULL</code></p>
  554. <p>Passed as <code class="code">user</code></p>
  555. </td>
  556. </tr>
  557. <tr>
  558. <td class="parameter_name"><p>password</p></td>
  559. <td class="parameter_description">
  560. <p>the password component of the userinfo, or <code class="constant">NULL</code></p>
  561. <p>Passed as <code class="code">password</code></p>
  562. </td>
  563. </tr>
  564. <tr>
  565. <td class="parameter_name"><p>auth_params</p></td>
  566. <td class="parameter_description">
  567. <p>the auth params of the userinfo, or <code class="constant">NULL</code></p>
  568. <p>Passed as <code class="code">auth-params</code></p>
  569. </td>
  570. </tr>
  571. <tr>
  572. <td class="parameter_name"><p>host</p></td>
  573. <td class="parameter_description">
  574. <p>the host component, or <code class="constant">NULL</code></p>
  575. <p>Passed as <code class="code">host</code></p>
  576. </td>
  577. </tr>
  578. <tr>
  579. <td class="parameter_name"><p>port</p></td>
  580. <td class="parameter_description">
  581. <p>the port, or <code class="code">-1</code></p>
  582. <p>Passed as <code class="code">port</code></p>
  583. </td>
  584. </tr>
  585. <tr>
  586. <td class="parameter_name"><p>path</p></td>
  587. <td class="parameter_description">
  588. <p>the path component</p>
  589. <p>Passed as <code class="code">path</code></p>
  590. </td>
  591. </tr>
  592. <tr>
  593. <td class="parameter_name"><p>query</p></td>
  594. <td class="parameter_description">
  595. <p>the query component, or <code class="constant">NULL</code></p>
  596. <p>Passed as <code class="code">query</code></p>
  597. </td>
  598. </tr>
  599. <tr>
  600. <td class="parameter_name"><p>fragment</p></td>
  601. <td class="parameter_description">
  602. <p>the fragment, or <code class="constant">NULL</code></p>
  603. <p>Passed as <code class="code">fragment</code></p>
  604. </td>
  605. </tr>
  606. </table></div>
  607. </div>
  608. </div>
  609. <div class="refsect2">
  610. <a name="id-1.1.78.3.18"></a><h3>uri:error-quark</h3>
  611. <div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:error-quark))
  612. </pre></div>
  613. <p>Undocumented</p>
  614. </div>
  615. <div class="refsect2">
  616. <a name="id-1.1.78.3.19"></a><h3>uri:escape-bytes</h3>
  617. <div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:escape-bytes unescaped reserved-chars-allowed))
  618. </pre></div>
  619. <p>Escapes arbitrary data for use in a URI.
  620. </p>
  621. <p>Normally all characters that are not ‘unreserved’ (i.e. ASCII
  622. alphanumerical characters plus dash, dot, underscore and tilde) are
  623. escaped. But if you specify characters in <em class="parameter"><code>reserved_chars_allowed</code></em>
  624. they are not escaped. This is useful for the ‘reserved’ characters
  625. in the URI specification, since those are allowed unescaped in some
  626. portions of a URI.
  627. </p>
  628. <p>Though technically incorrect, this will also allow escaping nul
  629. bytes as <code class="code">%</code><code class="code">00</code>.</p>
  630. <div class="refsect3">
  631. <a name="id-1.1.78.3.19.6"></a><h4>Parameters</h4>
  632. <div class="informaltable"><table>
  633. <tr>
  634. <td class="parameter_name"><p>unescaped</p></td>
  635. <td class="parameter_description">
  636. <p>the unescaped input data.</p>
  637. <p>Passed as <code class="code">unescaped</code></p>
  638. </td>
  639. </tr>
  640. <tr>
  641. <td class="parameter_name"><p>length</p></td>
  642. <td class="parameter_description">
  643. <p>the length of <em class="parameter"><code>unescaped</code></em></p>
  644. <p>Inferred from <code class="code">unescaped</code></p>
  645. </td>
  646. </tr>
  647. <tr>
  648. <td class="parameter_name"><p>reserved_chars_allowed</p></td>
  649. <td class="parameter_description">
  650. <p>a string of reserved
  651. characters that are allowed to be used, or <code class="constant">NULL</code>.</p>
  652. <p>Passed as <code class="code">reserved-chars-allowed</code></p>
  653. </td>
  654. </tr>
  655. </table></div>
  656. </div>
  657. </div>
  658. <div class="refsect2">
  659. <a name="id-1.1.78.3.20"></a><h3>uri:escape-string</h3>
  660. <div class="informalexample"><pre class="programlisting">(define-values
  661. (%return)
  662. (uri:escape-string unescaped reserved-chars-allowed allow-utf8))
  663. </pre></div>
  664. <p>Escapes a string for use in a URI.
  665. </p>
  666. <p>Normally all characters that are not "unreserved" (i.e. ASCII
  667. alphanumerical characters plus dash, dot, underscore and tilde) are
  668. escaped. But if you specify characters in <em class="parameter"><code>reserved_chars_allowed</code></em>
  669. they are not escaped. This is useful for the "reserved" characters
  670. in the URI specification, since those are allowed unescaped in some
  671. portions of a URI.</p>
  672. <div class="refsect3">
  673. <a name="id-1.1.78.3.20.5"></a><h4>Parameters</h4>
  674. <div class="informaltable"><table>
  675. <tr>
  676. <td class="parameter_name"><p>unescaped</p></td>
  677. <td class="parameter_description">
  678. <p>the unescaped input string.</p>
  679. <p>Passed as <code class="code">unescaped</code></p>
  680. </td>
  681. </tr>
  682. <tr>
  683. <td class="parameter_name"><p>reserved_chars_allowed</p></td>
  684. <td class="parameter_description">
  685. <p>a string of reserved
  686. characters that are allowed to be used, or <code class="constant">NULL</code>.</p>
  687. <p>Passed as <code class="code">reserved-chars-allowed</code></p>
  688. </td>
  689. </tr>
  690. <tr>
  691. <td class="parameter_name"><p>allow_utf8</p></td>
  692. <td class="parameter_description">
  693. <p><code class="constant">TRUE</code> if the result can include UTF-8 characters.</p>
  694. <p>Passed as <code class="code">allow-utf8</code></p>
  695. </td>
  696. </tr>
  697. </table></div>
  698. </div>
  699. </div>
  700. <div class="refsect2">
  701. <a name="id-1.1.78.3.21"></a><h3>uri:is-valid?</h3>
  702. <div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:is-valid? uri-string flags))
  703. </pre></div>
  704. <p>Parses <em class="parameter"><code>uri_string</code></em> according to <em class="parameter"><code>flags</code></em>, to determine whether it is a valid
  705. [absolute URI][relative-absolute-uris], i.e. it does not need to be resolved
  706. relative to another URI using <code class="function">g_uri_parse_relative()</code>.
  707. </p>
  708. <p>If it’s not a valid URI, an error is returned explaining how it’s invalid.
  709. </p>
  710. <p>See <code class="function">g_uri_split()</code>, and the definition of <span class="type">GUriFlags</span>, for more
  711. information on the effect of <em class="parameter"><code>flags</code></em>.</p>
  712. <div class="refsect3">
  713. <a name="id-1.1.78.3.21.6"></a><h4>Parameters</h4>
  714. <div class="informaltable"><table>
  715. <tr>
  716. <td class="parameter_name"><p>uri_string</p></td>
  717. <td class="parameter_description">
  718. <p>a string containing an absolute URI</p>
  719. <p>Passed as <code class="code">uri-string</code></p>
  720. </td>
  721. </tr>
  722. <tr>
  723. <td class="parameter_name"><p>flags</p></td>
  724. <td class="parameter_description">
  725. <p>flags for parsing <em class="parameter"><code>uri_string</code></em></p>
  726. <p>Passed as <code class="code">flags</code></p>
  727. </td>
  728. </tr>
  729. </table></div>
  730. </div>
  731. </div>
  732. <div class="refsect2">
  733. <a name="id-1.1.78.3.22"></a><h3>uri:join</h3>
  734. <div class="informalexample"><pre class="programlisting">(define-values
  735. (%return)
  736. (uri:join flags scheme userinfo host port path query fragment))
  737. </pre></div>
  738. <p>Joins the given components together according to <em class="parameter"><code>flags</code></em> to create
  739. an absolute URI string. <em class="parameter"><code>path</code></em> may not be <code class="constant">NULL</code> (though it may be the empty
  740. string).
  741. </p>
  742. <p>When <em class="parameter"><code>host</code></em> is present, <em class="parameter"><code>path</code></em> must either be empty or begin with a slash (<code class="code">/</code>)
  743. character. When <em class="parameter"><code>host</code></em> is not present, <em class="parameter"><code>path</code></em> cannot begin with two slash
  744. characters (<code class="code">//</code>). See
  745. [RFC 3986, section 3](https://tools.ietf.org/html/rfc3986#section-3).
  746. </p>
  747. <p>See also <code class="function">g_uri_join_with_user()</code>, which allows specifying the
  748. components of the ‘userinfo’ separately.
  749. </p>
  750. <p><code class="constant">G_URI_FLAGS_HAS_PASSWORD</code> and <code class="constant">G_URI_FLAGS_HAS_AUTH_PARAMS</code> are ignored if set
  751. in <em class="parameter"><code>flags</code></em>.</p>
  752. <div class="refsect3">
  753. <a name="id-1.1.78.3.22.7"></a><h4>Parameters</h4>
  754. <div class="informaltable"><table>
  755. <tr>
  756. <td class="parameter_name"><p>flags</p></td>
  757. <td class="parameter_description">
  758. <p>flags describing how to build the URI string</p>
  759. <p>Passed as <code class="code">flags</code></p>
  760. </td>
  761. </tr>
  762. <tr>
  763. <td class="parameter_name"><p>scheme</p></td>
  764. <td class="parameter_description">
  765. <p>the URI scheme, or <code class="constant">NULL</code></p>
  766. <p>Passed as <code class="code">scheme</code></p>
  767. </td>
  768. </tr>
  769. <tr>
  770. <td class="parameter_name"><p>userinfo</p></td>
  771. <td class="parameter_description">
  772. <p>the userinfo component, or <code class="constant">NULL</code></p>
  773. <p>Passed as <code class="code">userinfo</code></p>
  774. </td>
  775. </tr>
  776. <tr>
  777. <td class="parameter_name"><p>host</p></td>
  778. <td class="parameter_description">
  779. <p>the host component, or <code class="constant">NULL</code></p>
  780. <p>Passed as <code class="code">host</code></p>
  781. </td>
  782. </tr>
  783. <tr>
  784. <td class="parameter_name"><p>port</p></td>
  785. <td class="parameter_description">
  786. <p>the port, or <code class="code">-1</code></p>
  787. <p>Passed as <code class="code">port</code></p>
  788. </td>
  789. </tr>
  790. <tr>
  791. <td class="parameter_name"><p>path</p></td>
  792. <td class="parameter_description">
  793. <p>the path component</p>
  794. <p>Passed as <code class="code">path</code></p>
  795. </td>
  796. </tr>
  797. <tr>
  798. <td class="parameter_name"><p>query</p></td>
  799. <td class="parameter_description">
  800. <p>the query component, or <code class="constant">NULL</code></p>
  801. <p>Passed as <code class="code">query</code></p>
  802. </td>
  803. </tr>
  804. <tr>
  805. <td class="parameter_name"><p>fragment</p></td>
  806. <td class="parameter_description">
  807. <p>the fragment, or <code class="constant">NULL</code></p>
  808. <p>Passed as <code class="code">fragment</code></p>
  809. </td>
  810. </tr>
  811. </table></div>
  812. </div>
  813. </div>
  814. <div class="refsect2">
  815. <a name="id-1.1.78.3.23"></a><h3>uri:join-with-user</h3>
  816. <div class="informalexample"><pre class="programlisting">(define-values
  817. (%return)
  818. (uri:join-with-user
  819. flags
  820. scheme
  821. user
  822. password
  823. auth-params
  824. host
  825. port
  826. path
  827. query
  828. fragment))
  829. </pre></div>
  830. <p>Joins the given components together according to <em class="parameter"><code>flags</code></em> to create
  831. an absolute URI string. <em class="parameter"><code>path</code></em> may not be <code class="constant">NULL</code> (though it may be the empty
  832. string).
  833. </p>
  834. <p>In contrast to <code class="function">g_uri_join()</code>, this allows specifying the components
  835. of the ‘userinfo’ separately. It otherwise behaves the same.
  836. </p>
  837. <p><code class="constant">G_URI_FLAGS_HAS_PASSWORD</code> and <code class="constant">G_URI_FLAGS_HAS_AUTH_PARAMS</code> are ignored if set
  838. in <em class="parameter"><code>flags</code></em>.</p>
  839. <div class="refsect3">
  840. <a name="id-1.1.78.3.23.6"></a><h4>Parameters</h4>
  841. <div class="informaltable"><table>
  842. <tr>
  843. <td class="parameter_name"><p>flags</p></td>
  844. <td class="parameter_description">
  845. <p>flags describing how to build the URI string</p>
  846. <p>Passed as <code class="code">flags</code></p>
  847. </td>
  848. </tr>
  849. <tr>
  850. <td class="parameter_name"><p>scheme</p></td>
  851. <td class="parameter_description">
  852. <p>the URI scheme, or <code class="constant">NULL</code></p>
  853. <p>Passed as <code class="code">scheme</code></p>
  854. </td>
  855. </tr>
  856. <tr>
  857. <td class="parameter_name"><p>user</p></td>
  858. <td class="parameter_description">
  859. <p>the user component of the userinfo, or <code class="constant">NULL</code></p>
  860. <p>Passed as <code class="code">user</code></p>
  861. </td>
  862. </tr>
  863. <tr>
  864. <td class="parameter_name"><p>password</p></td>
  865. <td class="parameter_description">
  866. <p>the password component of the userinfo, or
  867. <code class="constant">NULL</code></p>
  868. <p>Passed as <code class="code">password</code></p>
  869. </td>
  870. </tr>
  871. <tr>
  872. <td class="parameter_name"><p>auth_params</p></td>
  873. <td class="parameter_description">
  874. <p>the auth params of the userinfo, or
  875. <code class="constant">NULL</code></p>
  876. <p>Passed as <code class="code">auth-params</code></p>
  877. </td>
  878. </tr>
  879. <tr>
  880. <td class="parameter_name"><p>host</p></td>
  881. <td class="parameter_description">
  882. <p>the host component, or <code class="constant">NULL</code></p>
  883. <p>Passed as <code class="code">host</code></p>
  884. </td>
  885. </tr>
  886. <tr>
  887. <td class="parameter_name"><p>port</p></td>
  888. <td class="parameter_description">
  889. <p>the port, or <code class="code">-1</code></p>
  890. <p>Passed as <code class="code">port</code></p>
  891. </td>
  892. </tr>
  893. <tr>
  894. <td class="parameter_name"><p>path</p></td>
  895. <td class="parameter_description">
  896. <p>the path component</p>
  897. <p>Passed as <code class="code">path</code></p>
  898. </td>
  899. </tr>
  900. <tr>
  901. <td class="parameter_name"><p>query</p></td>
  902. <td class="parameter_description">
  903. <p>the query component, or <code class="constant">NULL</code></p>
  904. <p>Passed as <code class="code">query</code></p>
  905. </td>
  906. </tr>
  907. <tr>
  908. <td class="parameter_name"><p>fragment</p></td>
  909. <td class="parameter_description">
  910. <p>the fragment, or <code class="constant">NULL</code></p>
  911. <p>Passed as <code class="code">fragment</code></p>
  912. </td>
  913. </tr>
  914. </table></div>
  915. </div>
  916. </div>
  917. <div class="refsect2">
  918. <a name="id-1.1.78.3.24"></a><h3>uri:list-extract-uris</h3>
  919. <div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:list-extract-uris uri-list))
  920. </pre></div>
  921. <p>Splits an URI list conforming to the text/uri-list
  922. mime type defined in RFC 2483 into individual URIs,
  923. discarding any comments. The URIs are not validated.</p>
  924. <div class="refsect3">
  925. <a name="id-1.1.78.3.24.4"></a><h4>Parameters</h4>
  926. <div class="informaltable"><table><tr>
  927. <td class="parameter_name"><p>uri_list</p></td>
  928. <td class="parameter_description">
  929. <p>an URI list</p>
  930. <p>Passed as <code class="code">uri-list</code></p>
  931. </td>
  932. </tr></table></div>
  933. </div>
  934. </div>
  935. <div class="refsect2">
  936. <a name="id-1.1.78.3.25"></a><h3>uri:parse</h3>
  937. <div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:parse uri-string flags))
  938. </pre></div>
  939. <p>Parses <em class="parameter"><code>uri_string</code></em> according to <em class="parameter"><code>flags</code></em>. If the result is not a
  940. valid [absolute URI][relative-absolute-uris], it will be discarded, and an
  941. error returned.</p>
  942. <div class="refsect3">
  943. <a name="id-1.1.78.3.25.4"></a><h4>Parameters</h4>
  944. <div class="informaltable"><table>
  945. <tr>
  946. <td class="parameter_name"><p>uri_string</p></td>
  947. <td class="parameter_description">
  948. <p>a string representing an absolute URI</p>
  949. <p>Passed as <code class="code">uri-string</code></p>
  950. </td>
  951. </tr>
  952. <tr>
  953. <td class="parameter_name"><p>flags</p></td>
  954. <td class="parameter_description">
  955. <p>flags describing how to parse <em class="parameter"><code>uri_string</code></em></p>
  956. <p>Passed as <code class="code">flags</code></p>
  957. </td>
  958. </tr>
  959. </table></div>
  960. </div>
  961. </div>
  962. <div class="refsect2">
  963. <a name="id-1.1.78.3.26"></a><h3>uri:parse-params</h3>
  964. <div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:parse-params params length separators flags))
  965. </pre></div>
  966. <p>Many URI schemes include one or more attribute/value pairs as part of the URI
  967. value. This method can be used to parse them into a hash table. When an
  968. attribute has multiple occurrences, the last value is the final returned
  969. value. If you need to handle repeated attributes differently, use
  970. <span class="type">GUriParamsIter</span>.
  971. </p>
  972. <p>The <em class="parameter"><code>params</code></em> string is assumed to still be <code class="code">%</code>-encoded, but the returned
  973. values will be fully decoded. (Thus it is possible that the returned values
  974. may contain <code class="code">=</code> or <em class="parameter"><code>separators</code></em>, if the value was encoded in the input.)
  975. Invalid <code class="code">%</code>-encoding is treated as with the <code class="constant">G_URI_FLAGS_PARSE_RELAXED</code>
  976. rules for <code class="function">g_uri_parse()</code>. (However, if <em class="parameter"><code>params</code></em> is the path or query string
  977. from a <span class="type">GUri</span> that was parsed without <code class="constant">G_URI_FLAGS_PARSE_RELAXED</code> and
  978. <code class="constant">G_URI_FLAGS_ENCODED</code>, then you already know that it does not contain any
  979. invalid encoding.)
  980. </p>
  981. <p><code class="constant">G_URI_PARAMS_WWW_FORM</code> is handled as documented for <code class="function">g_uri_params_iter_init()</code>.
  982. </p>
  983. <p>If <code class="constant">G_URI_PARAMS_CASE_INSENSITIVE</code> is passed to <em class="parameter"><code>flags</code></em>, attributes will be
  984. compared case-insensitively, so a params string <code class="code">attr=123&amp;Attr=456</code> will only
  985. return a single attribute–value pair, <code class="code">Attr=456</code>. Case will be preserved in
  986. the returned attributes.
  987. </p>
  988. <p>If <em class="parameter"><code>params</code></em> cannot be parsed (for example, it contains two <em class="parameter"><code>separators</code></em>
  989. characters in a row), then <em class="parameter"><code>error</code></em> is set and <code class="constant">NULL</code> is returned.</p>
  990. <div class="refsect3">
  991. <a name="id-1.1.78.3.26.8"></a><h4>Parameters</h4>
  992. <div class="informaltable"><table>
  993. <tr>
  994. <td class="parameter_name"><p>params</p></td>
  995. <td class="parameter_description">
  996. <p>a <code class="code">%</code>-encoded string containing <code class="code">attribute=value</code>
  997. parameters</p>
  998. <p>Passed as <code class="code">params</code></p>
  999. </td>
  1000. </tr>
  1001. <tr>
  1002. <td class="parameter_name"><p>length</p></td>
  1003. <td class="parameter_description">
  1004. <p>the length of <em class="parameter"><code>params</code></em>, or <code class="code">-1</code> if it is nul-terminated</p>
  1005. <p>Passed as <code class="code">length</code></p>
  1006. </td>
  1007. </tr>
  1008. <tr>
  1009. <td class="parameter_name"><p>separators</p></td>
  1010. <td class="parameter_description">
  1011. <p>the separator byte character set between parameters. (usually
  1012. <code class="code">&amp;</code>, but sometimes <code class="code">;</code> or both <code class="code">&amp;;</code>). Note that this function works on
  1013. bytes not characters, so it can't be used to delimit UTF-8 strings for
  1014. anything but ASCII characters. You may pass an empty set, in which case
  1015. no splitting will occur.</p>
  1016. <p>Passed as <code class="code">separators</code></p>
  1017. </td>
  1018. </tr>
  1019. <tr>
  1020. <td class="parameter_name"><p>flags</p></td>
  1021. <td class="parameter_description">
  1022. <p>flags to modify the way the parameters are handled.</p>
  1023. <p>Passed as <code class="code">flags</code></p>
  1024. </td>
  1025. </tr>
  1026. </table></div>
  1027. </div>
  1028. </div>
  1029. <div class="refsect2">
  1030. <a name="id-1.1.78.3.27"></a><h3>uri:parse-scheme</h3>
  1031. <div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:parse-scheme uri))
  1032. </pre></div>
  1033. <p>Gets the scheme portion of a URI string.
  1034. [RFC 3986](https://tools.ietf.org/html/rfc3986#section-3) decodes the scheme
  1035. as:
  1036. </p>
  1037. <div class="informalexample"><pre class="programlisting">
  1038. URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
  1039. </pre></div>
  1040. <p>Common schemes include <code class="code">file</code>, <code class="code">https</code>, <code class="code">svn+ssh</code>, etc.</p>
  1041. <div class="refsect3">
  1042. <a name="id-1.1.78.3.27.5"></a><h4>Parameters</h4>
  1043. <div class="informaltable"><table><tr>
  1044. <td class="parameter_name"><p>uri</p></td>
  1045. <td class="parameter_description">
  1046. <p>a valid URI.</p>
  1047. <p>Passed as <code class="code">uri</code></p>
  1048. </td>
  1049. </tr></table></div>
  1050. </div>
  1051. </div>
  1052. <div class="refsect2">
  1053. <a name="id-1.1.78.3.28"></a><h3>uri:peek-scheme</h3>
  1054. <div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:peek-scheme uri))
  1055. </pre></div>
  1056. <p>Gets the scheme portion of a URI string.
  1057. [RFC 3986](https://tools.ietf.org/html/rfc3986#section-3) decodes the scheme
  1058. as:
  1059. </p>
  1060. <div class="informalexample"><pre class="programlisting">
  1061. URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
  1062. </pre></div>
  1063. <p>Common schemes include <code class="code">file</code>, <code class="code">https</code>, <code class="code">svn+ssh</code>, etc.
  1064. </p>
  1065. <p>Unlike <code class="function">g_uri_parse_scheme()</code>, the returned scheme is normalized to
  1066. all-lowercase and does not need to be freed.</p>
  1067. <div class="refsect3">
  1068. <a name="id-1.1.78.3.28.6"></a><h4>Parameters</h4>
  1069. <div class="informaltable"><table><tr>
  1070. <td class="parameter_name"><p>uri</p></td>
  1071. <td class="parameter_description">
  1072. <p>a valid URI.</p>
  1073. <p>Passed as <code class="code">uri</code></p>
  1074. </td>
  1075. </tr></table></div>
  1076. </div>
  1077. </div>
  1078. <div class="refsect2">
  1079. <a name="id-1.1.78.3.29"></a><h3>uri:resolve-relative</h3>
  1080. <div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:resolve-relative base-uri-string uri-ref flags))
  1081. </pre></div>
  1082. <p>Parses <em class="parameter"><code>uri_ref</code></em> according to <em class="parameter"><code>flags</code></em> and, if it is a
  1083. [relative URI][relative-absolute-uris], resolves it relative to
  1084. <em class="parameter"><code>base_uri_string</code></em>. If the result is not a valid absolute URI, it will be
  1085. discarded, and an error returned.
  1086. </p>
  1087. <p>(If <em class="parameter"><code>base_uri_string</code></em> is <code class="constant">NULL</code>, this just returns <em class="parameter"><code>uri_ref</code></em>, or
  1088. <code class="constant">NULL</code> if <em class="parameter"><code>uri_ref</code></em> is invalid or not absolute.)</p>
  1089. <div class="refsect3">
  1090. <a name="id-1.1.78.3.29.5"></a><h4>Parameters</h4>
  1091. <div class="informaltable"><table>
  1092. <tr>
  1093. <td class="parameter_name"><p>base_uri_string</p></td>
  1094. <td class="parameter_description">
  1095. <p>a string representing a base URI</p>
  1096. <p>Passed as <code class="code">base-uri-string</code></p>
  1097. </td>
  1098. </tr>
  1099. <tr>
  1100. <td class="parameter_name"><p>uri_ref</p></td>
  1101. <td class="parameter_description">
  1102. <p>a string representing a relative or absolute URI</p>
  1103. <p>Passed as <code class="code">uri-ref</code></p>
  1104. </td>
  1105. </tr>
  1106. <tr>
  1107. <td class="parameter_name"><p>flags</p></td>
  1108. <td class="parameter_description">
  1109. <p>flags describing how to parse <em class="parameter"><code>uri_ref</code></em></p>
  1110. <p>Passed as <code class="code">flags</code></p>
  1111. </td>
  1112. </tr>
  1113. </table></div>
  1114. </div>
  1115. </div>
  1116. <div class="refsect2">
  1117. <a name="id-1.1.78.3.30"></a><h3>uri:split</h3>
  1118. <div class="informalexample"><pre class="programlisting">(define-values
  1119. (%return scheme userinfo host port path query fragment)
  1120. (uri:split uri-ref flags))
  1121. </pre></div>
  1122. <p>Parses <em class="parameter"><code>uri_ref</code></em> (which can be an
  1123. [absolute or relative URI][relative-absolute-uris]) according to <em class="parameter"><code>flags</code></em>, and
  1124. returns the pieces. Any component that doesn't appear in <em class="parameter"><code>uri_ref</code></em> will be
  1125. returned as <code class="constant">NULL</code> (but note that all URIs always have a path component,
  1126. though it may be the empty string).
  1127. </p>
  1128. <p>If <em class="parameter"><code>flags</code></em> contains <code class="constant">G_URI_FLAGS_ENCODED</code>, then <code class="code">%</code>-encoded characters in
  1129. <em class="parameter"><code>uri_ref</code></em> will remain encoded in the output strings. (If not,
  1130. then all such characters will be decoded.) Note that decoding will
  1131. only work if the URI components are ASCII or UTF-8, so you will
  1132. need to use <code class="constant">G_URI_FLAGS_ENCODED</code> if they are not.
  1133. </p>
  1134. <p>Note that the <code class="constant">G_URI_FLAGS_HAS_PASSWORD</code> and
  1135. <code class="constant">G_URI_FLAGS_HAS_AUTH_PARAMS</code> <em class="parameter"><code>flags</code></em> are ignored by <code class="function">g_uri_split()</code>,
  1136. since it always returns only the full userinfo; use
  1137. <code class="function">g_uri_split_with_user()</code> if you want it split up.</p>
  1138. <div class="refsect3">
  1139. <a name="id-1.1.78.3.30.6"></a><h4>Parameters</h4>
  1140. <div class="informaltable"><table>
  1141. <tr>
  1142. <td class="parameter_name"><p>uri_ref</p></td>
  1143. <td class="parameter_description">
  1144. <p>a string containing a relative or absolute URI</p>
  1145. <p>Passed as <code class="code">uri-ref</code></p>
  1146. </td>
  1147. </tr>
  1148. <tr>
  1149. <td class="parameter_name"><p>flags</p></td>
  1150. <td class="parameter_description">
  1151. <p>flags for parsing <em class="parameter"><code>uri_ref</code></em></p>
  1152. <p>Passed as <code class="code">flags</code></p>
  1153. </td>
  1154. </tr>
  1155. <tr>
  1156. <td class="parameter_name"><p>scheme</p></td>
  1157. <td class="parameter_description">
  1158. <p>on return, contains
  1159. the scheme (converted to lowercase), or <code class="constant">NULL</code></p>
  1160. <p>Passed as <code class="code">scheme</code></p>
  1161. </td>
  1162. </tr>
  1163. <tr>
  1164. <td class="parameter_name"><p>userinfo</p></td>
  1165. <td class="parameter_description">
  1166. <p>on return, contains
  1167. the userinfo, or <code class="constant">NULL</code></p>
  1168. <p>Passed as <code class="code">userinfo</code></p>
  1169. </td>
  1170. </tr>
  1171. <tr>
  1172. <td class="parameter_name"><p>host</p></td>
  1173. <td class="parameter_description">
  1174. <p>on return, contains the
  1175. host, or <code class="constant">NULL</code></p>
  1176. <p>Passed as <code class="code">host</code></p>
  1177. </td>
  1178. </tr>
  1179. <tr>
  1180. <td class="parameter_name"><p>port</p></td>
  1181. <td class="parameter_description">
  1182. <p>on return, contains the
  1183. port, or <code class="code">-1</code></p>
  1184. <p>Passed as <code class="code">port</code></p>
  1185. </td>
  1186. </tr>
  1187. <tr>
  1188. <td class="parameter_name"><p>path</p></td>
  1189. <td class="parameter_description">
  1190. <p>on return, contains the
  1191. path</p>
  1192. <p>Passed as <code class="code">path</code></p>
  1193. </td>
  1194. </tr>
  1195. <tr>
  1196. <td class="parameter_name"><p>query</p></td>
  1197. <td class="parameter_description">
  1198. <p>on return, contains the
  1199. query, or <code class="constant">NULL</code></p>
  1200. <p>Passed as <code class="code">query</code></p>
  1201. </td>
  1202. </tr>
  1203. <tr>
  1204. <td class="parameter_name"><p>fragment</p></td>
  1205. <td class="parameter_description">
  1206. <p>on return, contains
  1207. the fragment, or <code class="constant">NULL</code></p>
  1208. <p>Passed as <code class="code">fragment</code></p>
  1209. </td>
  1210. </tr>
  1211. </table></div>
  1212. </div>
  1213. </div>
  1214. <div class="refsect2">
  1215. <a name="id-1.1.78.3.31"></a><h3>uri:split-network</h3>
  1216. <div class="informalexample"><pre class="programlisting">(define-values
  1217. (%return scheme host port)
  1218. (uri:split-network uri-string flags))
  1219. </pre></div>
  1220. <p>Parses <em class="parameter"><code>uri_string</code></em> (which must be an [absolute URI][relative-absolute-uris])
  1221. according to <em class="parameter"><code>flags</code></em>, and returns the pieces relevant to connecting to a host.
  1222. See the documentation for <code class="function">g_uri_split()</code> for more details; this is
  1223. mostly a wrapper around that function with simpler arguments.
  1224. However, it will return an error if <em class="parameter"><code>uri_string</code></em> is a relative URI,
  1225. or does not contain a hostname component.</p>
  1226. <div class="refsect3">
  1227. <a name="id-1.1.78.3.31.4"></a><h4>Parameters</h4>
  1228. <div class="informaltable"><table>
  1229. <tr>
  1230. <td class="parameter_name"><p>uri_string</p></td>
  1231. <td class="parameter_description">
  1232. <p>a string containing an absolute URI</p>
  1233. <p>Passed as <code class="code">uri-string</code></p>
  1234. </td>
  1235. </tr>
  1236. <tr>
  1237. <td class="parameter_name"><p>flags</p></td>
  1238. <td class="parameter_description">
  1239. <p>flags for parsing <em class="parameter"><code>uri_string</code></em></p>
  1240. <p>Passed as <code class="code">flags</code></p>
  1241. </td>
  1242. </tr>
  1243. <tr>
  1244. <td class="parameter_name"><p>scheme</p></td>
  1245. <td class="parameter_description">
  1246. <p>on return, contains
  1247. the scheme (converted to lowercase), or <code class="constant">NULL</code></p>
  1248. <p>Passed as <code class="code">scheme</code></p>
  1249. </td>
  1250. </tr>
  1251. <tr>
  1252. <td class="parameter_name"><p>host</p></td>
  1253. <td class="parameter_description">
  1254. <p>on return, contains the
  1255. host, or <code class="constant">NULL</code></p>
  1256. <p>Passed as <code class="code">host</code></p>
  1257. </td>
  1258. </tr>
  1259. <tr>
  1260. <td class="parameter_name"><p>port</p></td>
  1261. <td class="parameter_description">
  1262. <p>on return, contains the
  1263. port, or <code class="code">-1</code></p>
  1264. <p>Passed as <code class="code">port</code></p>
  1265. </td>
  1266. </tr>
  1267. </table></div>
  1268. </div>
  1269. </div>
  1270. <div class="refsect2">
  1271. <a name="id-1.1.78.3.32"></a><h3>uri:split-with-user</h3>
  1272. <div class="informalexample"><pre class="programlisting">(define-values
  1273. (%return scheme user password auth-params host port path query fragment)
  1274. (uri:split-with-user uri-ref flags))
  1275. </pre></div>
  1276. <p>Parses <em class="parameter"><code>uri_ref</code></em> (which can be an
  1277. [absolute or relative URI][relative-absolute-uris]) according to <em class="parameter"><code>flags</code></em>, and
  1278. returns the pieces. Any component that doesn't appear in <em class="parameter"><code>uri_ref</code></em> will be
  1279. returned as <code class="constant">NULL</code> (but note that all URIs always have a path component,
  1280. though it may be the empty string).
  1281. </p>
  1282. <p>See <code class="function">g_uri_split()</code>, and the definition of <span class="type">GUriFlags</span>, for more
  1283. information on the effect of <em class="parameter"><code>flags</code></em>. Note that <em class="parameter"><code>password</code></em> will only
  1284. be parsed out if <em class="parameter"><code>flags</code></em> contains <code class="constant">G_URI_FLAGS_HAS_PASSWORD</code>, and
  1285. <em class="parameter"><code>auth_params</code></em> will only be parsed out if <em class="parameter"><code>flags</code></em> contains
  1286. <code class="constant">G_URI_FLAGS_HAS_AUTH_PARAMS</code>.</p>
  1287. <div class="refsect3">
  1288. <a name="id-1.1.78.3.32.5"></a><h4>Parameters</h4>
  1289. <div class="informaltable"><table>
  1290. <tr>
  1291. <td class="parameter_name"><p>uri_ref</p></td>
  1292. <td class="parameter_description">
  1293. <p>a string containing a relative or absolute URI</p>
  1294. <p>Passed as <code class="code">uri-ref</code></p>
  1295. </td>
  1296. </tr>
  1297. <tr>
  1298. <td class="parameter_name"><p>flags</p></td>
  1299. <td class="parameter_description">
  1300. <p>flags for parsing <em class="parameter"><code>uri_ref</code></em></p>
  1301. <p>Passed as <code class="code">flags</code></p>
  1302. </td>
  1303. </tr>
  1304. <tr>
  1305. <td class="parameter_name"><p>scheme</p></td>
  1306. <td class="parameter_description">
  1307. <p>on return, contains
  1308. the scheme (converted to lowercase), or <code class="constant">NULL</code></p>
  1309. <p>Passed as <code class="code">scheme</code></p>
  1310. </td>
  1311. </tr>
  1312. <tr>
  1313. <td class="parameter_name"><p>user</p></td>
  1314. <td class="parameter_description">
  1315. <p>on return, contains
  1316. the user, or <code class="constant">NULL</code></p>
  1317. <p>Passed as <code class="code">user</code></p>
  1318. </td>
  1319. </tr>
  1320. <tr>
  1321. <td class="parameter_name"><p>password</p></td>
  1322. <td class="parameter_description">
  1323. <p>on return, contains
  1324. the password, or <code class="constant">NULL</code></p>
  1325. <p>Passed as <code class="code">password</code></p>
  1326. </td>
  1327. </tr>
  1328. <tr>
  1329. <td class="parameter_name"><p>auth_params</p></td>
  1330. <td class="parameter_description">
  1331. <p>on return, contains
  1332. the auth_params, or <code class="constant">NULL</code></p>
  1333. <p>Passed as <code class="code">auth-params</code></p>
  1334. </td>
  1335. </tr>
  1336. <tr>
  1337. <td class="parameter_name"><p>host</p></td>
  1338. <td class="parameter_description">
  1339. <p>on return, contains the
  1340. host, or <code class="constant">NULL</code></p>
  1341. <p>Passed as <code class="code">host</code></p>
  1342. </td>
  1343. </tr>
  1344. <tr>
  1345. <td class="parameter_name"><p>port</p></td>
  1346. <td class="parameter_description">
  1347. <p>on return, contains the
  1348. port, or <code class="code">-1</code></p>
  1349. <p>Passed as <code class="code">port</code></p>
  1350. </td>
  1351. </tr>
  1352. <tr>
  1353. <td class="parameter_name"><p>path</p></td>
  1354. <td class="parameter_description">
  1355. <p>on return, contains the
  1356. path</p>
  1357. <p>Passed as <code class="code">path</code></p>
  1358. </td>
  1359. </tr>
  1360. <tr>
  1361. <td class="parameter_name"><p>query</p></td>
  1362. <td class="parameter_description">
  1363. <p>on return, contains the
  1364. query, or <code class="constant">NULL</code></p>
  1365. <p>Passed as <code class="code">query</code></p>
  1366. </td>
  1367. </tr>
  1368. <tr>
  1369. <td class="parameter_name"><p>fragment</p></td>
  1370. <td class="parameter_description">
  1371. <p>on return, contains
  1372. the fragment, or <code class="constant">NULL</code></p>
  1373. <p>Passed as <code class="code">fragment</code></p>
  1374. </td>
  1375. </tr>
  1376. </table></div>
  1377. </div>
  1378. </div>
  1379. <div class="refsect2">
  1380. <a name="id-1.1.78.3.33"></a><h3>uri:unescape-bytes</h3>
  1381. <div class="informalexample"><pre class="programlisting">(define-values
  1382. (%return)
  1383. (uri:unescape-bytes escaped-string length illegal-characters))
  1384. </pre></div>
  1385. <p>Unescapes a segment of an escaped string as binary data.
  1386. </p>
  1387. <p>Note that in contrast to <code class="function">g_uri_unescape_string()</code>, this does allow
  1388. nul bytes to appear in the output.
  1389. </p>
  1390. <p>If any of the characters in <em class="parameter"><code>illegal_characters</code></em> appears as an escaped
  1391. character in <em class="parameter"><code>escaped_string</code></em>, then that is an error and <code class="constant">NULL</code> will be
  1392. returned. This is useful if you want to avoid for instance having a slash
  1393. being expanded in an escaped path element, which might confuse pathname
  1394. handling.</p>
  1395. <div class="refsect3">
  1396. <a name="id-1.1.78.3.33.6"></a><h4>Parameters</h4>
  1397. <div class="informaltable"><table>
  1398. <tr>
  1399. <td class="parameter_name"><p>escaped_string</p></td>
  1400. <td class="parameter_description">
  1401. <p>A URI-escaped string</p>
  1402. <p>Passed as <code class="code">escaped-string</code></p>
  1403. </td>
  1404. </tr>
  1405. <tr>
  1406. <td class="parameter_name"><p>length</p></td>
  1407. <td class="parameter_description">
  1408. <p>the length (in bytes) of <em class="parameter"><code>escaped_string</code></em> to escape, or <code class="code">-1</code> if it
  1409. is nul-terminated.</p>
  1410. <p>Passed as <code class="code">length</code></p>
  1411. </td>
  1412. </tr>
  1413. <tr>
  1414. <td class="parameter_name"><p>illegal_characters</p></td>
  1415. <td class="parameter_description">
  1416. <p>a string of illegal characters
  1417. not to be allowed, or <code class="constant">NULL</code>.</p>
  1418. <p>Passed as <code class="code">illegal-characters</code></p>
  1419. </td>
  1420. </tr>
  1421. </table></div>
  1422. </div>
  1423. </div>
  1424. <div class="refsect2">
  1425. <a name="id-1.1.78.3.34"></a><h3>uri:unescape-segment</h3>
  1426. <div class="informalexample"><pre class="programlisting">(define-values
  1427. (%return)
  1428. (uri:unescape-segment escaped-string escaped-string-end illegal-characters))
  1429. </pre></div>
  1430. <p>Unescapes a segment of an escaped string.
  1431. </p>
  1432. <p>If any of the characters in <em class="parameter"><code>illegal_characters</code></em> or the NUL
  1433. character appears as an escaped character in <em class="parameter"><code>escaped_string</code></em>, then
  1434. that is an error and <code class="constant">NULL</code> will be returned. This is useful if you
  1435. want to avoid for instance having a slash being expanded in an
  1436. escaped path element, which might confuse pathname handling.
  1437. </p>
  1438. <p>Note: <code class="code">NUL</code> byte is not accepted in the output, in contrast to
  1439. <code class="function">g_uri_unescape_bytes()</code>.</p>
  1440. <div class="refsect3">
  1441. <a name="id-1.1.78.3.34.6"></a><h4>Parameters</h4>
  1442. <div class="informaltable"><table>
  1443. <tr>
  1444. <td class="parameter_name"><p>escaped_string</p></td>
  1445. <td class="parameter_description">
  1446. <p>A string, may be <code class="constant">NULL</code></p>
  1447. <p>Passed as <code class="code">escaped-string</code></p>
  1448. </td>
  1449. </tr>
  1450. <tr>
  1451. <td class="parameter_name"><p>escaped_string_end</p></td>
  1452. <td class="parameter_description">
  1453. <p>Pointer to end of <em class="parameter"><code>escaped_string</code></em>,
  1454. may be <code class="constant">NULL</code></p>
  1455. <p>Passed as <code class="code">escaped-string-end</code></p>
  1456. </td>
  1457. </tr>
  1458. <tr>
  1459. <td class="parameter_name"><p>illegal_characters</p></td>
  1460. <td class="parameter_description">
  1461. <p>An optional string of illegal
  1462. characters not to be allowed, may be <code class="constant">NULL</code></p>
  1463. <p>Passed as <code class="code">illegal-characters</code></p>
  1464. </td>
  1465. </tr>
  1466. </table></div>
  1467. </div>
  1468. </div>
  1469. <div class="refsect2">
  1470. <a name="id-1.1.78.3.35"></a><h3>uri:unescape-string</h3>
  1471. <div class="informalexample"><pre class="programlisting">(define-values
  1472. (%return)
  1473. (uri:unescape-string escaped-string illegal-characters))
  1474. </pre></div>
  1475. <p>Unescapes a whole escaped string.
  1476. </p>
  1477. <p>If any of the characters in <em class="parameter"><code>illegal_characters</code></em> or the NUL
  1478. character appears as an escaped character in <em class="parameter"><code>escaped_string</code></em>, then
  1479. that is an error and <code class="constant">NULL</code> will be returned. This is useful if you
  1480. want to avoid for instance having a slash being expanded in an
  1481. escaped path element, which might confuse pathname handling.</p>
  1482. <div class="refsect3">
  1483. <a name="id-1.1.78.3.35.5"></a><h4>Parameters</h4>
  1484. <div class="informaltable"><table>
  1485. <tr>
  1486. <td class="parameter_name"><p>escaped_string</p></td>
  1487. <td class="parameter_description">
  1488. <p>an escaped string to be unescaped.</p>
  1489. <p>Passed as <code class="code">escaped-string</code></p>
  1490. </td>
  1491. </tr>
  1492. <tr>
  1493. <td class="parameter_name"><p>illegal_characters</p></td>
  1494. <td class="parameter_description">
  1495. <p>a string of illegal characters
  1496. not to be allowed, or <code class="constant">NULL</code>.</p>
  1497. <p>Passed as <code class="code">illegal-characters</code></p>
  1498. </td>
  1499. </tr>
  1500. </table></div>
  1501. </div>
  1502. </div>
  1503. </div>
  1504. </div>
  1505. <div class="footer">
  1506. <hr>Generated by GTK-Doc V1.33.1</div>
  1507. </body>
  1508. </html>