]> git.pld-linux.org Git - packages/elinks.git/commitdiff
- fix crash on empty Content-Type, add Content-Type header to file uploads
authorJakub Bogusz <qboosh@pld-linux.org>
Fri, 5 Nov 2004 23:54:37 +0000 (23:54 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    elinks-content-type.patch -> 1.1

elinks-content-type.patch [new file with mode: 0644]

diff --git a/elinks-content-type.patch b/elinks-content-type.patch
new file mode 100644 (file)
index 0000000..be2dc5b
--- /dev/null
@@ -0,0 +1,50 @@
+src/mime/mime.c change fixes crash on empty Content-Type (due to hash lookup
+with empty ctype used as key)
+src/viewer/text/form.c change adds Content-Type header to file uploads
+(port from links-1.00pre8)
+
+--- elinks-0.9.2/src/mime/mime.c.orig  2004-07-29 12:10:10.000000000 +0200
++++ elinks-0.9.2/src/mime/mime.c       2004-11-05 23:30:59.877593784 +0100
+@@ -126,6 +126,10 @@
+       if (head) {
+               ctype = parse_http_header(head, "Content-Type", NULL);
+               if (ctype) {
++              if (*ctype == '\0') {
++                      /* treat empty Content-Type as not present (to avoid crash) */
++                      mem_free(ctype);
++              } else {
+                       unsigned char *end = strchr(ctype, ';');
+                       int ctypelen;
+@@ -139,6 +143,7 @@
+                       return ctype;
+               }
++              }
+       }
+       /* We can't use the extension string we are getting below, because we
+--- elinks-0.9.2/src/viewer/text/form.c.orig   2004-01-08 04:44:01.000000000 +0100
++++ elinks-0.9.2/src/viewer/text/form.c        2004-11-06 00:28:36.941040256 +0100
+@@ -562,13 +562,20 @@
+ #define F_BUFLEN 1024
+                       int fh, rd;
+                       unsigned char buffer[F_BUFLEN];
++                      unsigned char *ct;
+                       add_to_string(data, "\"; filename=\"");
+                       add_to_string(data, strip_file_name(sv->value));
+                       /* It sends bad data if the file name contains ", but
+                          Netscape does the same */
+                       /* FIXME: is this a reason ? --Zas */
+-                      add_to_string(data, "\"\r\n\r\n");
++                      add_to_string(data, "\"");
++                      if ((ct = get_content_type(NULL, sv->value))) {
++                              add_to_string(data, "\r\nContent-Type: ");
++                              add_to_string(data, ct);
++                              mem_free(ct);
++                      }
++                      add_to_string(data, "\r\n\r\n");
+                       if (*sv->value) {
+                               unsigned char *filename;
This page took 0.034838 seconds and 4 git commands to generate.