Pārlūkot izejas kodu

core: parse content type allows '_' char

- reported by Fabio Margarido, GH #547
Daniel-Constantin Mierla 9 gadi atpakaļ
vecāks
revīzija
b65927a8f6
1 mainītis faili ar 7 papildinājumiem un 7 dzēšanām
  1. 7 7
      parser/parse_content.c

+ 7 - 7
parser/parse_content.c

@@ -13,8 +13,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  * GNU General Public License for more details.
  *
  *
- * You should have received a copy of the GNU General Public License 
- * along with this program; if not, write to the Free Software 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  *
  */
  */
@@ -38,7 +38,7 @@
 
 
 
 
 #define is_mime_char(_c_) \
 #define is_mime_char(_c_) \
-	(isalpha((int)_c_) || (_c_)=='-' || (_c_)=='+' || (_c_)=='.')
+	(isalpha((int)_c_) || (_c_)=='-' || (_c_)=='+' || (_c_)=='.' || (_c_)=='_')
 #define is_char_equal(_c_,_cs_) \
 #define is_char_equal(_c_,_cs_) \
 	( (isalpha((int)_c_)?(((_c_)|0x20)==(_cs_)):((_c_)==(_cs_)))==1 )
 	( (isalpha((int)_c_)?(((_c_)|0x20)==(_cs_)):((_c_)==(_cs_)))==1 )
 
 
@@ -180,7 +180,7 @@ static type_node_t subtype_tree[] = {
 									{'c',SUBTYPE_UNKNOWN,1,-1},
 									{'c',SUBTYPE_UNKNOWN,1,-1},
 										{'.',SUBTYPE_UNKNOWN,1,-1},
 										{'.',SUBTYPE_UNKNOWN,1,-1},
 											{'p',SUBTYPE_UNKNOWN,1,-1},
 											{'p',SUBTYPE_UNKNOWN,1,-1},
-												{'i',SUBTYPE_UNKNOWN,1,-1}, 
+												{'i',SUBTYPE_UNKNOWN,1,-1},
 													{'d',SUBTYPE_UNKNOWN,1,-1},
 													{'d',SUBTYPE_UNKNOWN,1,-1},
 														{'f',SUBTYPE_XML_MSRTC_PIDF,0,-1},
 														{'f',SUBTYPE_XML_MSRTC_PIDF,0,-1},
 	{'e',SUBTYPE_UNKNOWN,1,107}, /* 94 */
 	{'e',SUBTYPE_UNKNOWN,1,107}, /* 94 */
@@ -327,7 +327,7 @@ char* decode_mime_type(char* const start, const char* const end, unsigned int* c
 			if (node!=-1) {
 			if (node!=-1) {
 				type_candidate = subtype_tree[node].final;
 				type_candidate = subtype_tree[node].final;
 				if (subtype_tree[node].nr_sons)
 				if (subtype_tree[node].nr_sons)
-        				node++;
+					node++;
 				else
 				else
 					node = -1;
 					node = -1;
 			} else {
 			} else {
@@ -432,10 +432,10 @@ int parse_accept_body(struct hdr_field* const hdr)
 	char *ret;
 	char *ret;
 
 
 	if (!hdr) return -1;
 	if (!hdr) return -1;
-	
+
 	/* maybe the header is already parsed! */
 	/* maybe the header is already parsed! */
 	if (hdr->parsed!=0) return 1;
 	if (hdr->parsed!=0) return 1;
-	
+
 	/* it seams we have to parse it! :-( */
 	/* it seams we have to parse it! :-( */
 	ret = hdr->body.s;
 	ret = hdr->body.s;
 	end = ret + hdr->body.len;
 	end = ret + hdr->body.len;