@@ -309,9 +309,9 @@ def __init__(self, value, *args):
309
309
class Types (Container ):
310
310
"""Container for MIME type mapping."""
311
311
312
- def __init__ (self , value , * args ):
312
+ def __init__ (self , * args ):
313
313
"""Initialize."""
314
- super (Types , self ).__init__ (value , * args )
314
+ super (Types , self ).__init__ ('' , * args )
315
315
self .name = 'types'
316
316
317
317
@@ -436,49 +436,56 @@ def loads(data, conf=True):
436
436
index += m .end ()
437
437
continue
438
438
439
- m = re .compile (r'^\s*location\s*(. *?)\s*{' , re .S ).search (data [index :])
439
+ m = re .compile (r'^\s*location\s*([^;] *?)\s*{' , re .S ).search (data [index :])
440
440
if m :
441
441
l = Location (m .group (1 ))
442
442
lopen .insert (0 , l )
443
443
index += m .end ()
444
444
continue
445
445
446
- m = re .compile (r'^\s*if\s*(. *?)\s*{' , re .S ).search (data [index :])
446
+ m = re .compile (r'^\s*if\s*([^;] *?)\s*{' , re .S ).search (data [index :])
447
447
if m :
448
448
ifs = If (m .group (1 ))
449
449
lopen .insert (0 , ifs )
450
450
index += m .end ()
451
451
continue
452
452
453
- m = re .compile (r'^\s*upstream\s*(. *?)\s*{' , re .S ).search (data [index :])
453
+ m = re .compile (r'^\s*upstream\s*([^;] *?)\s*{' , re .S ).search (data [index :])
454
454
if m :
455
455
u = Upstream (m .group (1 ))
456
456
lopen .insert (0 , u )
457
457
index += m .end ()
458
458
continue
459
459
460
- m = re .compile (r'^\s*geo\s*(. *?)\s*{' , re .S ).search (data [index :])
460
+ m = re .compile (r'^\s*geo\s*([^;] *?)\s*{' , re .S ).search (data [index :])
461
461
if m :
462
462
g = Geo (m .group (1 ))
463
463
lopen .insert (0 , g )
464
464
index += m .end ()
465
465
continue
466
466
467
- m = re .compile (r'^\s*map\s*(. *?)\s*{' , re .S ).search (data [index :])
467
+ m = re .compile (r'^\s*map\s*([^;] *?)\s*{' , re .S ).search (data [index :])
468
468
if m :
469
469
g = Map (m .group (1 ))
470
470
lopen .insert (0 , g )
471
471
index += m .end ()
472
472
continue
473
473
474
- m = re .compile (r'^\s*limit_except\s*(. *?)\s*{' , re .S ).search (data [index :])
474
+ m = re .compile (r'^\s*limit_except\s*([^;] *?)\s*{' , re .S ).search (data [index :])
475
475
if m :
476
476
l = LimitExcept (m .group (1 ))
477
477
lopen .insert (0 , l )
478
478
index += m .end ()
479
479
continue
480
480
481
- m = re .compile (r'^(\s*)#\s*(.*?)\n' , re .S ).search (data [index :])
481
+ m = re .compile (r'^\s*types\s*{' , re .S ).search (data [index :])
482
+ if m :
483
+ l = Types ()
484
+ lopen .insert (0 , l )
485
+ index += m .end ()
486
+ continue
487
+
488
+ m = re .compile (r'^(\s*)#[ \r\t\f]*(.*?)\n' , re .S ).search (data [index :])
482
489
if m :
483
490
c = Comment (m .group (2 ), inline = '\n ' not in m .group (1 ))
484
491
if lopen and isinstance (lopen [0 ], Container ):
0 commit comments