]> git.pld-linux.org Git - packages/elinks.git/blame - elinks-content-type.patch
- updated to 0.10rc1
[packages/elinks.git] / elinks-content-type.patch
CommitLineData
31c66043
JB
1src/mime/mime.c change fixes crash on empty Content-Type (due to hash lookup
2with empty ctype used as key)
3src/viewer/text/form.c change adds Content-Type header to file uploads
4(port from links-1.00pre8)
5
6--- elinks-0.9.2/src/mime/mime.c.orig 2004-07-29 12:10:10.000000000 +0200
7+++ elinks-0.9.2/src/mime/mime.c 2004-11-05 23:30:59.877593784 +0100
8@@ -126,6 +126,10 @@
9 if (head) {
10 ctype = parse_http_header(head, "Content-Type", NULL);
11 if (ctype) {
12+ if (*ctype == '\0') {
13+ /* treat empty Content-Type as not present (to avoid crash) */
14+ mem_free(ctype);
15+ } else {
16 unsigned char *end = strchr(ctype, ';');
17 int ctypelen;
18
19@@ -139,6 +143,7 @@
20
21 return ctype;
22 }
23+ }
24 }
25
26 /* We can't use the extension string we are getting below, because we
27--- elinks-0.9.2/src/viewer/text/form.c.orig 2004-01-08 04:44:01.000000000 +0100
28+++ elinks-0.9.2/src/viewer/text/form.c 2004-11-06 00:28:36.941040256 +0100
29@@ -562,13 +562,20 @@
30 #define F_BUFLEN 1024
31 int fh, rd;
32 unsigned char buffer[F_BUFLEN];
33+ unsigned char *ct;
34
35 add_to_string(data, "\"; filename=\"");
36 add_to_string(data, strip_file_name(sv->value));
37 /* It sends bad data if the file name contains ", but
38 Netscape does the same */
39 /* FIXME: is this a reason ? --Zas */
40- add_to_string(data, "\"\r\n\r\n");
41+ add_to_string(data, "\"");
42+ if ((ct = get_content_type(NULL, sv->value))) {
43+ add_to_string(data, "\r\nContent-Type: ");
44+ add_to_string(data, ct);
45+ mem_free(ct);
46+ }
47+ add_to_string(data, "\r\n\r\n");
48
49 if (*sv->value) {
50 unsigned char *filename;
This page took 0.029267 seconds and 4 git commands to generate.