Lines Matching refs:uri

33 #include <gpxe/uri.h>
38 * @v uri URI
40 static void dump_uri ( struct uri *uri ) {
41 if ( ! uri )
43 if ( uri->scheme )
44 DBG ( " scheme \"%s\"", uri->scheme );
45 if ( uri->opaque )
46 DBG ( " opaque \"%s\"", uri->opaque );
47 if ( uri->user )
48 DBG ( " user \"%s\"", uri->user );
49 if ( uri->password )
50 DBG ( " password \"%s\"", uri->password );
51 if ( uri->host )
52 DBG ( " host \"%s\"", uri->host );
53 if ( uri->port )
54 DBG ( " port \"%s\"", uri->port );
55 if ( uri->path )
56 DBG ( " path \"%s\"", uri->path );
57 if ( uri->query )
58 DBG ( " query \"%s\"", uri->query );
59 if ( uri->fragment )
60 DBG ( " fragment \"%s\"", uri->fragment );
67 * @ret uri URI
73 struct uri * parse_uri ( const char *uri_string ) {
74 struct uri *uri;
84 uri = zalloc ( sizeof ( *uri ) + raw_len );
85 if ( ! uri )
87 raw = ( ( ( char * ) uri ) + sizeof ( *uri ) );
95 uri->fragment = tmp;
105 uri->scheme = raw;
112 uri->opaque = tmp;
128 uri->query = tmp;
142 uri->path = tmp;
150 uri->path = path;
157 uri->host = tmp;
158 uri->user = authority;
162 uri->password = tmp;
166 uri->host = authority;
170 if ( ( tmp = strchr ( uri->host, ':' ) ) ) {
172 uri->port = tmp;
177 const char *field = uri_get_field ( uri, i );
185 dump_uri ( uri );
188 return uri;
194 * @v uri URI, or NULL
198 unsigned int uri_port ( struct uri *uri, unsigned int default_port ) {
199 if ( ( ! uri ) || ( ! uri->port ) )
201 return ( strtoul ( uri->port, NULL, 0 ) );
209 * @v uri URI to write into buffer, or NULL
213 int unparse_uri ( char *buf, size_t size, struct uri *uri,
225 dump_uri ( uri );
233 if ( ! uri )
238 const char *field = uri_get_field ( uri, i );
277 * @v uri URI
278 * @ret uri Duplicate URI
282 struct uri * uri_dup ( struct uri *uri ) {
283 size_t len = ( unparse_uri ( NULL, 0, uri, URI_ALL ) + 1 );
286 unparse_uri ( buf, len, uri, URI_ALL );
363 struct uri * resolve_uri ( struct uri *base_uri,
364 struct uri *relative_uri ) {
365 struct uri tmp_uri;
367 struct uri *new_uri;