1#!/usr/bin/env python3 2from io import StringIO 3 4from gentokenlookup import gentokenlookup 5 6# copied from llhttp.h, and stripped trailing spaces and backslashes. 7SRC = ''' 8 XX(0, DELETE, DELETE) 9 XX(1, GET, GET) 10 XX(2, HEAD, HEAD) 11 XX(3, POST, POST) 12 XX(4, PUT, PUT) 13 XX(5, CONNECT, CONNECT) 14 XX(6, OPTIONS, OPTIONS) 15 XX(7, TRACE, TRACE) 16 XX(8, COPY, COPY) 17 XX(9, LOCK, LOCK) 18 XX(10, MKCOL, MKCOL) 19 XX(11, MOVE, MOVE) 20 XX(12, PROPFIND, PROPFIND) 21 XX(13, PROPPATCH, PROPPATCH) 22 XX(14, SEARCH, SEARCH) 23 XX(15, UNLOCK, UNLOCK) 24 XX(16, BIND, BIND) 25 XX(17, REBIND, REBIND) 26 XX(18, UNBIND, UNBIND) 27 XX(19, ACL, ACL) 28 XX(20, REPORT, REPORT) 29 XX(21, MKACTIVITY, MKACTIVITY) 30 XX(22, CHECKOUT, CHECKOUT) 31 XX(23, MERGE, MERGE) 32 XX(24, MSEARCH, M-SEARCH) 33 XX(25, NOTIFY, NOTIFY) 34 XX(26, SUBSCRIBE, SUBSCRIBE) 35 XX(27, UNSUBSCRIBE, UNSUBSCRIBE) 36 XX(28, PATCH, PATCH) 37 XX(29, PURGE, PURGE) 38 XX(30, MKCALENDAR, MKCALENDAR) 39 XX(31, LINK, LINK) 40 XX(32, UNLINK, UNLINK) 41 XX(33, SOURCE, SOURCE) 42''' 43 44if __name__ == '__main__': 45 methods = [] 46 for line in StringIO(SRC): 47 line = line.strip() 48 if not line.startswith('XX'): 49 continue 50 _, m, _ = line.split(',', 2) 51 methods.append(m.strip()) 52 gentokenlookup(methods, 'HTTP_') 53