mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Fix saving files from speccy.pl archives
This commit is contained in:
parent
e9152c8772
commit
29d85fdb3b
@ -352,7 +352,7 @@ set_cookie(struct uri *uri, unsigned char *str)
|
|||||||
|
|
||||||
if (!parse_cookie_str(&cstr, str)) return;
|
if (!parse_cookie_str(&cstr, str)) return;
|
||||||
|
|
||||||
switch (parse_header_param(str, "path", &path)) {
|
switch (parse_header_param(str, "path", &path, 0)) {
|
||||||
unsigned char *path_end;
|
unsigned char *path_end;
|
||||||
|
|
||||||
case HEADER_PARAM_FOUND:
|
case HEADER_PARAM_FOUND:
|
||||||
@ -381,7 +381,7 @@ set_cookie(struct uri *uri, unsigned char *str)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parse_header_param(str, "domain", &domain) == HEADER_PARAM_NOT_FOUND)
|
if (parse_header_param(str, "domain", &domain, 0) == HEADER_PARAM_NOT_FOUND)
|
||||||
domain = memacpy(uri->host, uri->hostlen);
|
domain = memacpy(uri->host, uri->hostlen);
|
||||||
if (domain && domain[0] == '.')
|
if (domain && domain[0] == '.')
|
||||||
memmove(domain, domain + 1, strlen(domain));
|
memmove(domain, domain + 1, strlen(domain));
|
||||||
@ -424,7 +424,7 @@ set_cookie(struct uri *uri, unsigned char *str)
|
|||||||
unsigned char *date;
|
unsigned char *date;
|
||||||
time_t expires;
|
time_t expires;
|
||||||
|
|
||||||
switch (parse_header_param(str, "expires", &date)) {
|
switch (parse_header_param(str, "expires", &date, 0)) {
|
||||||
case HEADER_PARAM_FOUND:
|
case HEADER_PARAM_FOUND:
|
||||||
expires = parse_date(&date, NULL, 0, 1); /* Convert date to seconds. */
|
expires = parse_date(&date, NULL, 0, 1); /* Convert date to seconds. */
|
||||||
|
|
||||||
@ -452,7 +452,7 @@ set_cookie(struct uri *uri, unsigned char *str)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cookie->secure = (parse_header_param(str, "secure", NULL)
|
cookie->secure = (parse_header_param(str, "secure", NULL, 0)
|
||||||
== HEADER_PARAM_FOUND);
|
== HEADER_PARAM_FOUND);
|
||||||
|
|
||||||
#ifdef DEBUG_COOKIES
|
#ifdef DEBUG_COOKIES
|
||||||
|
@ -609,7 +609,7 @@ get_convert_table(unsigned char *head, int to_cp,
|
|||||||
|
|
||||||
if (!a) break;
|
if (!a) break;
|
||||||
|
|
||||||
parse_header_param(a, "charset", &ct_charset);
|
parse_header_param(a, "charset", &ct_charset, 0);
|
||||||
if (ct_charset) {
|
if (ct_charset) {
|
||||||
cp_index = get_cp_index(ct_charset);
|
cp_index = get_cp_index(ct_charset);
|
||||||
mem_free(ct_charset);
|
mem_free(ct_charset);
|
||||||
|
@ -65,7 +65,7 @@ get_content_filename(struct uri *uri, struct cache_entry *cached)
|
|||||||
pos = parse_header(cached->head, "Content-Disposition", NULL);
|
pos = parse_header(cached->head, "Content-Disposition", NULL);
|
||||||
if (!pos) return NULL;
|
if (!pos) return NULL;
|
||||||
|
|
||||||
parse_header_param(pos, "filename", &filename);
|
parse_header_param(pos, "filename", &filename, 1);
|
||||||
mem_free(pos);
|
mem_free(pos);
|
||||||
if (!filename) return NULL;
|
if (!filename) return NULL;
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ parse_header(unsigned char *head, const unsigned char *item, unsigned char **ptr
|
|||||||
* and cannot fail with HEADER_PARAM_OUT_OF_MEMORY. Some callers may
|
* and cannot fail with HEADER_PARAM_OUT_OF_MEMORY. Some callers may
|
||||||
* rely on this. */
|
* rely on this. */
|
||||||
enum parse_header_param
|
enum parse_header_param
|
||||||
parse_header_param(unsigned char *str, unsigned char *name, unsigned char **ret)
|
parse_header_param(unsigned char *str, unsigned char *name, unsigned char **ret, int content_disposition)
|
||||||
{
|
{
|
||||||
unsigned char *p = str;
|
unsigned char *p = str;
|
||||||
int namelen, plen = 0;
|
int namelen, plen = 0;
|
||||||
@ -247,8 +247,10 @@ parse_header_param(unsigned char *str, unsigned char *name, unsigned char **ret)
|
|||||||
|
|
||||||
namelen = strlen(name);
|
namelen = strlen(name);
|
||||||
do {
|
do {
|
||||||
p = strchr((const char *)p, ';');
|
if (!content_disposition) {
|
||||||
if (!p) return HEADER_PARAM_NOT_FOUND;
|
p = strchr((const char *)p, ';');
|
||||||
|
if (!p) return HEADER_PARAM_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
while (*p && (*p == ';' || *p <= ' ')) p++;
|
while (*p && (*p == ';' || *p <= ' ')) p++;
|
||||||
if (strlen(p) < namelen) return HEADER_PARAM_NOT_FOUND;
|
if (strlen(p) < namelen) return HEADER_PARAM_NOT_FOUND;
|
||||||
|
@ -10,7 +10,7 @@ enum parse_header_param {
|
|||||||
};
|
};
|
||||||
|
|
||||||
unsigned char *parse_header(unsigned char *, const unsigned char *, unsigned char **);
|
unsigned char *parse_header(unsigned char *, const unsigned char *, unsigned char **);
|
||||||
enum parse_header_param parse_header_param(unsigned char *, unsigned char *, unsigned char **);
|
enum parse_header_param parse_header_param(unsigned char *, unsigned char *, unsigned char **, int);
|
||||||
unsigned char *get_header_param(unsigned char *, unsigned char *);
|
unsigned char *get_header_param(unsigned char *, unsigned char *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user