Browse code

core: parse content type allows '_' char

- reported by Fabio Margarido, GH #547

Daniel-Constantin Mierla authored on 18/03/2016 12:32:59
Showing 1 changed files
... ...
@@ -13,8 +13,8 @@
13 13
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 14
  * GNU General Public License for more details.
15 15
  *
16
- * You should have received a copy of the GNU General Public License 
17
- * along with this program; if not, write to the Free Software 
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with this program; if not, write to the Free Software
18 18
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19 19
  *
20 20
  */
... ...
@@ -38,7 +38,7 @@
38 38
 
39 39
 
40 40
 #define is_mime_char(_c_) \
41
-	(isalpha((int)_c_) || (_c_)=='-' || (_c_)=='+' || (_c_)=='.')
41
+	(isalpha((int)_c_) || (_c_)=='-' || (_c_)=='+' || (_c_)=='.' || (_c_)=='_')
42 42
 #define is_char_equal(_c_,_cs_) \
43 43
 	( (isalpha((int)_c_)?(((_c_)|0x20)==(_cs_)):((_c_)==(_cs_)))==1 )
44 44
 
... ...
@@ -180,7 +180,7 @@ static type_node_t subtype_tree[] = {
180 180
 									{'c',SUBTYPE_UNKNOWN,1,-1},
181 181
 										{'.',SUBTYPE_UNKNOWN,1,-1},
182 182
 											{'p',SUBTYPE_UNKNOWN,1,-1},
183
-												{'i',SUBTYPE_UNKNOWN,1,-1}, 
183
+												{'i',SUBTYPE_UNKNOWN,1,-1},
184 184
 													{'d',SUBTYPE_UNKNOWN,1,-1},
185 185
 														{'f',SUBTYPE_XML_MSRTC_PIDF,0,-1},
186 186
 	{'e',SUBTYPE_UNKNOWN,1,107}, /* 94 */
... ...
@@ -327,7 +327,7 @@ char* decode_mime_type(char* const start, const char* const end, unsigned int* c
327 327
 			if (node!=-1) {
328 328
 				type_candidate = subtype_tree[node].final;
329 329
 				if (subtype_tree[node].nr_sons)
330
-        				node++;
330
+					node++;
331 331
 				else
332 332
 					node = -1;
333 333
 			} else {
... ...
@@ -432,10 +432,10 @@ int parse_accept_body(struct hdr_field* const hdr)
432 432
 	char *ret;
433 433
 
434 434
 	if (!hdr) return -1;
435
-	
435
+
436 436
 	/* maybe the header is already parsed! */
437 437
 	if (hdr->parsed!=0) return 1;
438
-	
438
+
439 439
 	/* it seams we have to parse it! :-( */
440 440
 	ret = hdr->body.s;
441 441
 	end = ret + hdr->body.len;