diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-01-05 14:44:10 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-01-05 15:17:27 -0800 |
| commit | 1b2f22fd68a2e50cabdfe2e036096cc9e7a05a1f (patch) | |
| tree | 95fc90338cbe38a46e561511604cf8ed079934fd /src/core/url.c | |
| parent | 224dae56a379aa309fca261d61e7e356b14a536f (diff) | |
| download | nng-1b2f22fd68a2e50cabdfe2e036096cc9e7a05a1f.tar.gz nng-1b2f22fd68a2e50cabdfe2e036096cc9e7a05a1f.tar.bz2 nng-1b2f22fd68a2e50cabdfe2e036096cc9e7a05a1f.zip | |
Convert existing websocket and http code to use new URL framework.
This also fixes a use-after-free bug in the HTTP framework, where the
handler could be deleted why callbacks were still using it. (We now
reference count the handlers.)
Diffstat (limited to 'src/core/url.c')
| -rw-r--r-- | src/core/url.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/core/url.c b/src/core/url.c index 8dee5219..8cb5a2e7 100644 --- a/src/core/url.c +++ b/src/core/url.c @@ -1,6 +1,6 @@ // -// Copyright 2017 Garrett D'Amore <garrett@damore.org> -// Copyright 2017 Capitar IT Group BV <info@capitar.com> +// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2018 Capitar IT Group BV <info@capitar.com> // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -250,13 +250,17 @@ nni_url_parse(nni_url **urlp, const char *raw) } if ((url->u_host = nni_alloc(len + 1)) == NULL) { - nni_url_free(url); - return (NNG_ENOMEM); + rv = NNG_ENOMEM; + goto error; } memcpy(url->u_host, s, len); url->u_host[len] = '\0'; s += len; + if ((url->u_rawpath = nni_strdup(s)) == NULL) { + rv = NNG_ENOMEM; + goto error; + } for (len = 0; (c = s[len]) != '\0'; len++) { if ((c == '?') || (c == '#')) { break; @@ -363,5 +367,6 @@ 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_FREE_STRUCT(url); }
\ No newline at end of file |
