]> pd.if.org Git - zpackage/commitdiff
send full encoded queries
authorNathan Wagner <nw@hydaspes.if.org>
Wed, 27 Feb 2019 04:17:57 +0000 (04:17 +0000)
committerNathan Wagner <nw@hydaspes.if.org>
Wed, 27 Feb 2019 04:17:57 +0000 (04:17 +0000)
crypto/rfc3986.re
doc/zpm-fetchurl.8
doc/zpm-pkgdeps.8
src/fetchurl.c

index feaf49ac0340942c92700db180b867c49ce4d61b..ce7ce8a9c2b63e8ccd36c674fc37c811397d2d82 100644 (file)
@@ -20,7 +20,9 @@ struct tls_uri {
        char *host;
        char *port;
        char *path;
        char *host;
        char *port;
        char *path;
+       char *encoded_path;
        char *query;
        char *query;
+       char *encoded_query;
        char *fragment;
 };
 
        char *fragment;
 };
 
@@ -202,6 +204,13 @@ 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);
        percent_decode(uri->host);
        percent_decode(uri->path);
        percent_decode(uri->query);
@@ -230,5 +239,8 @@ void tls_free_uri(struct tls_uri *uri) {
        uri->scheme = 0;
        free(uri->fragment);
        uri->fragment = 0;
        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;
 }
 }
index d3948df3290e0e3a526d01eb1a961e53d0e488df..6df17c8f2a506ccd4cd75dcbb6f13d10834f378e 100644 (file)
@@ -1,4 +1,4 @@
-.TH zpm-fetchurl 8 2019-02-16 "ZPM 0.4"
+.TH zpm-fetchurl 8 2019-02-27 "ZPM 0.4"
 .SH NAME
 zpm-fetchurl \- download files
 .SH SYNOPSIS
 .SH NAME
 zpm-fetchurl \- download files
 .SH SYNOPSIS
@@ -27,7 +27,7 @@ dependency.
 output the response header only, implies -r
 .TP
 .B \-r
 output the response header only, implies -r
 .TP
 .B \-r
-output the entire response header, including the header
+output the entire response, including the header
 .TP
 .B \-S
 output the response status code only
 .TP
 .B \-S
 output the response status code only
index cdda3765b2226c9ead5d031263cb7db5f2faeb58..ccb06d2c1e79acccae5165bf731e0e3cbf719587 100644 (file)
@@ -1,19 +1,13 @@
-.TH zpm-pkgdeps 8 2019-02-22 "ZPM 0.3"
+.TH zpm-pkgdeps 8 2019-02-26 "ZPM 0.3"
 .SH NAME
 zpm-pkgdeps \- run pkgdeps
 .SH SYNOPSIS
 .SH NAME
 zpm-pkgdeps \- run pkgdeps
 .SH SYNOPSIS
-               f) pkgfile="$OPTARG" ;;
-               s) setlist="$setlist $OPTARG"; clearlist=1 ;;
-               a) add="$add $OPTARG"; ;;
-               r) remove="$remove $OPTARG" ;;
-               q) quiet=1 ;;
-               c) clearlist=1 ;;
 .B zpm pkgdeps
 [
 .BI \-f " pkgfile"
 ]
 [
 .B zpm pkgdeps
 [
 .BI \-f " pkgfile"
 ]
 [
-.B \-qc
+.B \-qcL
 ]
 [
 .BI \-s " dep"
 ]
 [
 .BI \-s " dep"
@@ -41,6 +35,9 @@ It is not an error if a dependency to remove is not present.
 Dependencies are package ids, and thus can't have whitespace or illegal
 characters.  Illegal characters are not checked for, and whitespace
 will be interpreted as separating dependencies.
 Dependencies are package ids, and thus can't have whitespace or illegal
 characters.  Illegal characters are not checked for, and whitespace
 will be interpreted as separating dependencies.
+.PP
+In addition to printing package dependencies, library soname dependencies
+will be printed unless the \-L option is given.
 .SH OPTIONS
 .TP
 .BI \-f package
 .SH OPTIONS
 .TP
 .BI \-f package
index 1ef4abd2c1f70901b01ca1ff020e4ce9d20e7278..21e2e661e7a85fa169e81f792a9154acdb3ad8eb 100644 (file)
@@ -22,9 +22,12 @@ struct tls_uri {
        char *host;
        char *port;
        char *path;
        char *host;
        char *port;
        char *path;
+       char *encoded_path;
        char *query;
        char *query;
+       char *encoded_query;
        char *fragment;
 };
        char *fragment;
 };
+
 int tls_parse_uri(char *, struct tls_uri *);
 void tls_free_uri(struct tls_uri *);
 
 int tls_parse_uri(char *, struct tls_uri *);
 void tls_free_uri(struct tls_uri *);
 
@@ -583,6 +586,7 @@ int main(int ac, char *av[]) {
        struct tls_buffer request;
        char lmtime[80];
        char *eoh = 0;
        struct tls_buffer request;
        char lmtime[80];
        char *eoh = 0;
+       char *user_agent = 0;
        size_t total = 0;
        size_t header_len;
        char *url = 0;
        size_t total = 0;
        size_t header_len;
        char *url = 0;
@@ -591,13 +595,14 @@ int main(int ac, char *av[]) {
 
        ltc_mp = tfm_desc;
 
 
        ltc_mp = tfm_desc;
 
-       while ((option = getopt(ac, av, "o:OrIfz:np#R:SkK")) != -1) {
+       while ((option = getopt(ac, av, "o:OrIfz:np#R:SkKU:")) != -1) {
                switch (option) {
                        case 'o': outfile = optarg; break;
                        case 'O': calcoutfile = 1; break;
                        case 'S': printstatus = 1; head = 1; break;
                        case 'k': verifypolicy = 0; break;
                        case 'K': verifypolicy = 2; break;
                switch (option) {
                        case 'o': outfile = optarg; break;
                        case 'O': calcoutfile = 1; break;
                        case 'S': printstatus = 1; head = 1; break;
                        case 'k': verifypolicy = 0; break;
                        case 'K': verifypolicy = 2; break;
+                       case 'U': user_agent = optarg; break;
                        case 'I': head = 1;
                        case 'r': raw = 1; break;
                        case 'f': failsilent = 1; break;
                        case 'I': head = 1;
                        case 'r': raw = 1; break;
                        case 'f': failsilent = 1; break;
@@ -680,10 +685,18 @@ int main(int ac, char *av[]) {
                } else {
                        tls_buffer_append(&request, "GET ", 4);
                }
                } else {
                        tls_buffer_append(&request, "GET ", 4);
                }
-               tls_buffer_append(&request, uri.path, strlen(uri.path));
+               tls_buffer_append(&request, uri.encoded_path, strlen(uri.encoded_path));
+               if (uri.encoded_query) {
+                       tls_buffer_append(&request, "?", 1);
+                       tls_buffer_append(&request, uri.encoded_query, strlen(uri.encoded_query));
+               }
                tls_buffer_append(&request, " HTTP/1.1\r\n", 11);
 
                append_header(&request, "Host", host);
                tls_buffer_append(&request, " HTTP/1.1\r\n", 11);
 
                append_header(&request, "Host", host);
+               if (user_agent) {
+                       append_header(&request, "User-Agent", user_agent);
+               }
+               append_header(&request, "Accept", "*/*");
                append_header(&request, "Connection", "close");
                if (lmfile) {
                        append_header(&request, "If-Modified-Since", lmtime);
                append_header(&request, "Connection", "close");
                if (lmfile) {
                        append_header(&request, "If-Modified-Since", lmtime);