summaryrefslogtreecommitdiff
path: root/src/htslib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/htslib.c')
-rw-r--r--src/htslib.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/htslib.c b/src/htslib.c
index e691902..ff41d4f 100644
--- a/src/htslib.c
+++ b/src/htslib.c
@@ -3105,7 +3105,7 @@ int ishtml(httrackp *opt,const char* fil) {
*a = '\0';
}
if (get_userhttptype(opt, mime, fil_noquery)) {
- if (strfield2(mime, "text/html")) {
+ if (is_html_mime_type(mime)) {
return 1;
} else {
return 0;
@@ -3702,15 +3702,15 @@ HTSEXT_API char* unescape_http(char *catbuff, const char* s) {
}
// unescape in URL/URI ONLY what has to be escaped, to form a standard URL/URI
-// DOES NOT DECODE %25
+// DOES NOT DECODE %25 (part of CHAR_DELIM)
HTSEXT_API char* unescape_http_unharm(char *catbuff, const char* s, int no_high) {
int i,j=0;
for (i=0;i<(int) strlen(s);i++) {
if (s[i]=='%') {
int nchar=(char) ehex(s+i+1);
- int test = ( CHAR_RESERVED(nchar)
- || ( nchar != '%' && CHAR_DELIM(nchar) )
+ int test = ( ( CHAR_RESERVED(nchar) && nchar != '+' ) /* %2B => + (not in query!) */
+ || CHAR_DELIM(nchar)
|| CHAR_UNWISE(nchar)
|| CHAR_LOW(nchar) /* CHAR_SPECIAL */
|| CHAR_XXAVOID(nchar)
@@ -3822,9 +3822,13 @@ HTSEXT_API void x_escape_http(char* s,int mode) {
|| CHAR_XXAVOID(*s) );
}
else if (mode==30) { // échapper que ce qui est nécessaire
- test = (
- CHAR_LOW(*s)
- || CHAR_XXAVOID(*s) );
+ test =
+ ( *s != '/' && CHAR_RESERVED(*s) )
+ || CHAR_DELIM(*s)
+ || CHAR_UNWISE(*s)
+ || CHAR_SPECIAL(*s)
+ || CHAR_XXAVOID(*s)
+ ;
}
if (test) {
@@ -4155,7 +4159,7 @@ HTSEXT_API int is_knowntype(httrackp *opt,const char *fil) {
ext = get_ext(catbuff, fil);
while(strnotempty(hts_mime[j][1])) {
if (strfield2(hts_mime[j][1], ext)) {
- if (strfield2(hts_mime[j][0], "text/html"))
+ if (is_html_mime_type(hts_mime[j][0]))
return 2;
else
return 1;
@@ -4201,7 +4205,7 @@ HTSEXT_API int is_userknowntype(httrackp *opt,const char *fil) {
get_userhttptype(opt, mime, fil);
if (!strnotempty(mime))
return 0;
- else if (strfield2(mime,"text/html"))
+ else if (is_html_mime_type(mime))
return 2;
else
return 1;