]> pd.if.org Git - zpackage/blobdiff - crypto/rfc3986.re
remove stray debug fprintf
[zpackage] / crypto / rfc3986.re
index 463486f6968549138fd98c5a5b2476b1dd4434dc..ce7ce8a9c2b63e8ccd36c674fc37c811397d2d82 100644 (file)
@@ -20,7 +20,9 @@ struct tls_uri {
        char *host;
        char *port;
        char *path;
+       char *encoded_path;
        char *query;
+       char *encoded_query;
        char *fragment;
 };
 
@@ -202,10 +204,16 @@ int tls_parse_uri(char *s, struct tls_uri *uri) {
                }
        }
 
+       if (uri->path) {
+               uri->encoded_path = strdup(uri->path);
+       }
+       if (uri->query) {
+               uri->encoded_query = strdup(uri->query);
+       }
+       
        percent_decode(uri->host);
        percent_decode(uri->path);
        percent_decode(uri->query);
-
        
        if (uri->path == NULL || uri->path[0] == 0) {
                free(uri->path);
@@ -215,10 +223,24 @@ int tls_parse_uri(char *s, struct tls_uri *uri) {
        return rv;
 }
 
+#define MARK fprintf(stderr, "%s %s:%d\n", __FILE__, __func__, __LINE__)
 void tls_free_uri(struct tls_uri *uri) {
+       if (!uri) return;
+
        free(uri->host);
+       uri->host = 0;
        free(uri->path);
+       uri->path = 0;
        free(uri->query);
+       uri->query = 0;
        free(uri->port);
+       uri->port = 0;
        free(uri->scheme);
+       uri->scheme = 0;
+       free(uri->fragment);
+       uri->fragment = 0;
+       free(uri->encoded_path);
+       uri->encoded_path = 0;
+       free(uri->encoded_query);
+       uri->encoded_query = 0;
 }