aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-02-02 10:57:18 -0800
committerGarrett D'Amore <garrett@damore.org>2018-02-02 10:57:18 -0800
commit490bc97dbf76fae2a99c8bacd5fd9be332d68b90 (patch)
tree5504c23957e99ef5290c9048fedc27b1dbc25e77 /src
parent5e5f814d63d4e00365b0ae726bc18831aa28e88f (diff)
downloadnng-490bc97dbf76fae2a99c8bacd5fd9be332d68b90.tar.gz
nng-490bc97dbf76fae2a99c8bacd5fd9be332d68b90.tar.bz2
nng-490bc97dbf76fae2a99c8bacd5fd9be332d68b90.zip
Add, and document, the url->u_requri member.
This member is the value passed in actual HTTP protocol, so it is useful with the function nng_http_req_set_uri().
Diffstat (limited to 'src')
-rw-r--r--src/core/url.c8
-rw-r--r--src/core/url.h19
-rw-r--r--src/nng.h2
-rw-r--r--src/supplemental/http/http_msg.c2
4 files changed, 10 insertions, 21 deletions
diff --git a/src/core/url.c b/src/core/url.c
index 88a0cf0a..6a2a4e53 100644
--- a/src/core/url.c
+++ b/src/core/url.c
@@ -340,11 +340,11 @@ nni_url_parse(nni_url **urlp, const char *raw)
url->u_host[len] = '\0';
s += len;
- if ((rv = url_canonify_uri(&url->u_rawpath, s)) != 0) {
+ if ((rv = url_canonify_uri(&url->u_requri, s)) != 0) {
goto error;
}
- s = url->u_rawpath;
+ s = url->u_requri;
for (len = 0; (c = s[len]) != '\0'; len++) {
if ((c == '?') || (c == '#')) {
break;
@@ -450,7 +450,7 @@ nni_url_free(nni_url *url)
nni_strfree(url->u_path);
nni_strfree(url->u_query);
nni_strfree(url->u_fragment);
- nni_strfree(url->u_rawpath);
+ nni_strfree(url->u_requri);
NNI_FREE_STRUCT(url);
}
@@ -469,7 +469,7 @@ nni_url_clone(nni_url **dstp, const nni_url *src)
URL_COPYSTR(dst->u_host, src->u_host) ||
URL_COPYSTR(dst->u_hostname, src->u_hostname) ||
URL_COPYSTR(dst->u_port, src->u_port) ||
- URL_COPYSTR(dst->u_rawpath, src->u_rawpath) ||
+ URL_COPYSTR(dst->u_requri, src->u_requri) ||
URL_COPYSTR(dst->u_path, src->u_path) ||
URL_COPYSTR(dst->u_query, src->u_query) ||
URL_COPYSTR(dst->u_fragment, src->u_fragment)) {
diff --git a/src/core/url.h b/src/core/url.h
index b3407277..b96401bd 100644
--- a/src/core/url.h
+++ b/src/core/url.h
@@ -11,22 +11,11 @@
#ifndef CORE_URL_H
#define CORE_URL_H
-struct nni_url {
- char *u_rawurl; // never NULL
- char *u_scheme; // never NULL
- char *u_userinfo; // will be NULL if not specified
- char *u_host; // including colon and port
- char *u_hostname; // name only, will be "" if not specified
- char *u_port; // port, will be "" if not specified
- char *u_path; // path, will be "" if not specified
- char *u_query; // without '?', will be NULL if not specified
- char *u_fragment; // without '#', will be NULL if not specified
- char *u_rawpath; // includes query and fragment, "" if not specified
-};
+#include "core/defs.h"
-extern int nni_url_parse(nni_url **, const char *path);
-extern void nni_url_free(nni_url *);
-extern int nni_url_clone(nni_url **, const nni_url *);
+extern int nni_url_parse(nni_url **, const char *path);
+extern void nni_url_free(nni_url *);
+extern int nni_url_clone(nni_url **, const nni_url *);
extern const char *nni_url_default_port(const char *);
#endif // CORE_URL_H
diff --git a/src/nng.h b/src/nng.h
index 98c42dc6..a5b3346a 100644
--- a/src/nng.h
+++ b/src/nng.h
@@ -761,7 +761,7 @@ typedef struct nng_url {
char *u_path; // path, will be "" if not specified
char *u_query; // without '?', will be NULL if not specified
char *u_fragment; // without '#', will be NULL if not specified
- char *u_rawpath; // includes query and fragment, "" if not specified
+ char *u_requri; // includes query and fragment, "" if not specified
} nng_url;
// nng_url_parse parses a URL string into a structured form.
diff --git a/src/supplemental/http/http_msg.c b/src/supplemental/http/http_msg.c
index 81c1b453..9a5bac68 100644
--- a/src/supplemental/http/http_msg.c
+++ b/src/supplemental/http/http_msg.c
@@ -591,7 +591,7 @@ nni_http_req_alloc(nni_http_req **reqp, const nni_url *url)
if (url != NULL) {
const char *host;
int rv;
- if ((req->uri = nni_strdup(url->u_rawpath)) == NULL) {
+ if ((req->uri = nni_strdup(url->u_requri)) == NULL) {
NNI_FREE_STRUCT(req);
return (NNG_ENOMEM);
}