http-url.h revision c911297407bdcc7c7936305eb8f791b450d6375c
2d0611ffc9f91c5fc2ddccb93f9a3d17791ae650takashi#ifndef HTTP_URL_H
2d0611ffc9f91c5fc2ddccb93f9a3d17791ae650takashi#define HTTP_URL_H
dc0d8d65d35787d30a275895ccad8d8e1b58a5ednd
dc0d8d65d35787d30a275895ccad8d8e1b58a5ednd#include "net.h"
dc0d8d65d35787d30a275895ccad8d8e1b58a5ednd
7fb4c0766e858653c9776474005a6ae6d94828afgryzorstruct http_url {
7fb4c0766e858653c9776474005a6ae6d94828afgryzor /* server */
7fb4c0766e858653c9776474005a6ae6d94828afgryzor const char *host_name;
7fb4c0766e858653c9776474005a6ae6d94828afgryzor struct ip_addr host_ip;
in_port_t port;
/* path */
const char *path;
/* ?query (still encoded) */
const char *enc_query;
/* #fragment (still encoded) */
const char *enc_fragment;
unsigned int have_host_ip:1; /* URL uses IP address */
unsigned int have_port:1;
unsigned int have_ssl:1;
};
/*
* HTTP URL parsing
*/
enum http_url_parse_flags {
/* Scheme part 'http:' is already parsed externally. This implies that
this is an absolute HTTP URL. */
HTTP_URL_PARSE_SCHEME_EXTERNAL = 0x01,
/* Allow '#fragment' part in URL */
HTTP_URL_ALLOW_FRAGMENT_PART = 0x02
};
int http_url_parse(const char *url, struct http_url *base,
enum http_url_parse_flags flags, pool_t pool,
struct http_url **url_r, const char **error_r);
/*
* HTTP URL construction
*/
const char *http_url_create(const struct http_url *url);
void http_url_escape_param(string_t *out, const char *data);
#endif