From 743ed473203608d70fe4a473130fe5e0f3a1e89a Mon Sep 17 00:00:00 2001 From: taiphyyy Date: Sat, 2 Mar 2024 16:26:01 +0900 Subject: [PATCH 01/10] Test invalid size of header --- .../request_file/invalid_header_size.txt | 1006 +++++++++++++++++ .../response_file/invalid_header_size.txt | 5 + 2 files changed, 1011 insertions(+) create mode 100644 tests/simple_server_function_test/request_file/invalid_header_size.txt create mode 100644 tests/simple_server_function_test/response_file/invalid_header_size.txt diff --git a/tests/simple_server_function_test/request_file/invalid_header_size.txt b/tests/simple_server_function_test/request_file/invalid_header_size.txt new file mode 100644 index 0000000..fc71be2 --- /dev/null +++ b/tests/simple_server_function_test/request_file/invalid_header_size.txt @@ -0,0 +1,1006 @@ +host, localhost +port, 8080 + + +GET / HTTP/1.1 +Host: test1 +Connection: closeX_TEST0: test +X_TEST1: test +X_TEST2: test +X_TEST3: test +X_TEST4: test +X_TEST5: test +X_TEST6: test +X_TEST7: test +X_TEST8: test +X_TEST9: test +X_TEST10: test +X_TEST11: test +X_TEST12: test +X_TEST13: test +X_TEST14: test +X_TEST15: test +X_TEST16: test +X_TEST17: test +X_TEST18: test +X_TEST19: test +X_TEST20: test +X_TEST21: test +X_TEST22: test +X_TEST23: test +X_TEST24: test +X_TEST25: test +X_TEST26: test +X_TEST27: test +X_TEST28: test +X_TEST29: test +X_TEST30: test +X_TEST31: test +X_TEST32: test +X_TEST33: test +X_TEST34: test +X_TEST35: test +X_TEST36: test +X_TEST37: test +X_TEST38: test +X_TEST39: test +X_TEST40: test +X_TEST41: test +X_TEST42: test +X_TEST43: test +X_TEST44: test +X_TEST45: test +X_TEST46: test +X_TEST47: test +X_TEST48: test +X_TEST49: test +X_TEST50: test +X_TEST51: test +X_TEST52: test +X_TEST53: test +X_TEST54: test +X_TEST55: test +X_TEST56: test +X_TEST57: test +X_TEST58: test +X_TEST59: test +X_TEST60: test +X_TEST61: test +X_TEST62: test +X_TEST63: test +X_TEST64: test +X_TEST65: test +X_TEST66: test +X_TEST67: test +X_TEST68: test +X_TEST69: test +X_TEST70: test +X_TEST71: test +X_TEST72: test +X_TEST73: test +X_TEST74: test +X_TEST75: test +X_TEST76: test +X_TEST77: test +X_TEST78: test +X_TEST79: test +X_TEST80: test +X_TEST81: test +X_TEST82: test +X_TEST83: test +X_TEST84: test +X_TEST85: test +X_TEST86: test +X_TEST87: test +X_TEST88: test +X_TEST89: test +X_TEST90: test +X_TEST91: test +X_TEST92: test +X_TEST93: test +X_TEST94: test +X_TEST95: test +X_TEST96: test +X_TEST97: test +X_TEST98: test +X_TEST99: test +X_TEST100: test +X_TEST101: test +X_TEST102: test +X_TEST103: test +X_TEST104: test +X_TEST105: test +X_TEST106: test +X_TEST107: test +X_TEST108: test +X_TEST109: test +X_TEST110: test +X_TEST111: test +X_TEST112: test +X_TEST113: test +X_TEST114: test +X_TEST115: test +X_TEST116: test +X_TEST117: test +X_TEST118: test +X_TEST119: test +X_TEST120: test +X_TEST121: test +X_TEST122: test +X_TEST123: test +X_TEST124: test +X_TEST125: test +X_TEST126: test +X_TEST127: test +X_TEST128: test +X_TEST129: test +X_TEST130: test +X_TEST131: test +X_TEST132: test +X_TEST133: test +X_TEST134: test +X_TEST135: test +X_TEST136: test +X_TEST137: test +X_TEST138: test +X_TEST139: test +X_TEST140: test +X_TEST141: test +X_TEST142: test +X_TEST143: test +X_TEST144: test +X_TEST145: test +X_TEST146: test +X_TEST147: test +X_TEST148: test +X_TEST149: test +X_TEST150: test +X_TEST151: test +X_TEST152: test +X_TEST153: test +X_TEST154: test +X_TEST155: test +X_TEST156: test +X_TEST157: test +X_TEST158: test +X_TEST159: test +X_TEST160: test +X_TEST161: test +X_TEST162: test +X_TEST163: test +X_TEST164: test +X_TEST165: test +X_TEST166: test +X_TEST167: test +X_TEST168: test +X_TEST169: test +X_TEST170: test +X_TEST171: test +X_TEST172: test +X_TEST173: test +X_TEST174: test +X_TEST175: test +X_TEST176: test +X_TEST177: test +X_TEST178: test +X_TEST179: test +X_TEST180: test +X_TEST181: test +X_TEST182: test +X_TEST183: test +X_TEST184: test +X_TEST185: test +X_TEST186: test +X_TEST187: test +X_TEST188: test +X_TEST189: test +X_TEST190: test +X_TEST191: test +X_TEST192: test +X_TEST193: test +X_TEST194: test +X_TEST195: test +X_TEST196: test +X_TEST197: test +X_TEST198: test +X_TEST199: test +X_TEST200: test +X_TEST201: test +X_TEST202: test +X_TEST203: test +X_TEST204: test +X_TEST205: test +X_TEST206: test +X_TEST207: test +X_TEST208: test +X_TEST209: test +X_TEST210: test +X_TEST211: test +X_TEST212: test +X_TEST213: test +X_TEST214: test +X_TEST215: test +X_TEST216: test +X_TEST217: test +X_TEST218: test +X_TEST219: test +X_TEST220: test +X_TEST221: test +X_TEST222: test +X_TEST223: test +X_TEST224: test +X_TEST225: test +X_TEST226: test +X_TEST227: test +X_TEST228: test +X_TEST229: test +X_TEST230: test +X_TEST231: test +X_TEST232: test +X_TEST233: test +X_TEST234: test +X_TEST235: test +X_TEST236: test +X_TEST237: test +X_TEST238: test +X_TEST239: test +X_TEST240: test +X_TEST241: test +X_TEST242: test +X_TEST243: test +X_TEST244: test +X_TEST245: test +X_TEST246: test +X_TEST247: test +X_TEST248: test +X_TEST249: test +X_TEST250: test +X_TEST251: test +X_TEST252: test +X_TEST253: test +X_TEST254: test +X_TEST255: test +X_TEST256: test +X_TEST257: test +X_TEST258: test +X_TEST259: test +X_TEST260: test +X_TEST261: test +X_TEST262: test +X_TEST263: test +X_TEST264: test +X_TEST265: test +X_TEST266: test +X_TEST267: test +X_TEST268: test +X_TEST269: test +X_TEST270: test +X_TEST271: test +X_TEST272: test +X_TEST273: test +X_TEST274: test +X_TEST275: test +X_TEST276: test +X_TEST277: test +X_TEST278: test +X_TEST279: test +X_TEST280: test +X_TEST281: test +X_TEST282: test +X_TEST283: test +X_TEST284: test +X_TEST285: test +X_TEST286: test +X_TEST287: test +X_TEST288: test +X_TEST289: test +X_TEST290: test +X_TEST291: test +X_TEST292: test +X_TEST293: test +X_TEST294: test +X_TEST295: test +X_TEST296: test +X_TEST297: test +X_TEST298: test +X_TEST299: test +X_TEST300: test +X_TEST301: test +X_TEST302: test +X_TEST303: test +X_TEST304: test +X_TEST305: test +X_TEST306: test +X_TEST307: test +X_TEST308: test +X_TEST309: test +X_TEST310: test +X_TEST311: test +X_TEST312: test +X_TEST313: test +X_TEST314: test +X_TEST315: test +X_TEST316: test +X_TEST317: test +X_TEST318: test +X_TEST319: test +X_TEST320: test +X_TEST321: test +X_TEST322: test +X_TEST323: test +X_TEST324: test +X_TEST325: test +X_TEST326: test +X_TEST327: test +X_TEST328: test +X_TEST329: test +X_TEST330: test +X_TEST331: test +X_TEST332: test +X_TEST333: test +X_TEST334: test +X_TEST335: test +X_TEST336: test +X_TEST337: test +X_TEST338: test +X_TEST339: test +X_TEST340: test +X_TEST341: test +X_TEST342: test +X_TEST343: test +X_TEST344: test +X_TEST345: test +X_TEST346: test +X_TEST347: test +X_TEST348: test +X_TEST349: test +X_TEST350: test +X_TEST351: test +X_TEST352: test +X_TEST353: test +X_TEST354: test +X_TEST355: test +X_TEST356: test +X_TEST357: test +X_TEST358: test +X_TEST359: test +X_TEST360: test +X_TEST361: test +X_TEST362: test +X_TEST363: test +X_TEST364: test +X_TEST365: test +X_TEST366: test +X_TEST367: test +X_TEST368: test +X_TEST369: test +X_TEST370: test +X_TEST371: test +X_TEST372: test +X_TEST373: test +X_TEST374: test +X_TEST375: test +X_TEST376: test +X_TEST377: test +X_TEST378: test +X_TEST379: test +X_TEST380: test +X_TEST381: test +X_TEST382: test +X_TEST383: test +X_TEST384: test +X_TEST385: test +X_TEST386: test +X_TEST387: test +X_TEST388: test +X_TEST389: test +X_TEST390: test +X_TEST391: test +X_TEST392: test +X_TEST393: test +X_TEST394: test +X_TEST395: test +X_TEST396: test +X_TEST397: test +X_TEST398: test +X_TEST399: test +X_TEST400: test +X_TEST401: test +X_TEST402: test +X_TEST403: test +X_TEST404: test +X_TEST405: test +X_TEST406: test +X_TEST407: test +X_TEST408: test +X_TEST409: test +X_TEST410: test +X_TEST411: test +X_TEST412: test +X_TEST413: test +X_TEST414: test +X_TEST415: test +X_TEST416: test +X_TEST417: test +X_TEST418: test +X_TEST419: test +X_TEST420: test +X_TEST421: test +X_TEST422: test +X_TEST423: test +X_TEST424: test +X_TEST425: test +X_TEST426: test +X_TEST427: test +X_TEST428: test +X_TEST429: test +X_TEST430: test +X_TEST431: test +X_TEST432: test +X_TEST433: test +X_TEST434: test +X_TEST435: test +X_TEST436: test +X_TEST437: test +X_TEST438: test +X_TEST439: test +X_TEST440: test +X_TEST441: test +X_TEST442: test +X_TEST443: test +X_TEST444: test +X_TEST445: test +X_TEST446: test +X_TEST447: test +X_TEST448: test +X_TEST449: test +X_TEST450: test +X_TEST451: test +X_TEST452: test +X_TEST453: test +X_TEST454: test +X_TEST455: test +X_TEST456: test +X_TEST457: test +X_TEST458: test +X_TEST459: test +X_TEST460: test +X_TEST461: test +X_TEST462: test +X_TEST463: test +X_TEST464: test +X_TEST465: test +X_TEST466: test +X_TEST467: test +X_TEST468: test +X_TEST469: test +X_TEST470: test +X_TEST471: test +X_TEST472: test +X_TEST473: test +X_TEST474: test +X_TEST475: test +X_TEST476: test +X_TEST477: test +X_TEST478: test +X_TEST479: test +X_TEST480: test +X_TEST481: test +X_TEST482: test +X_TEST483: test +X_TEST484: test +X_TEST485: test +X_TEST486: test +X_TEST487: test +X_TEST488: test +X_TEST489: test +X_TEST490: test +X_TEST491: test +X_TEST492: test +X_TEST493: test +X_TEST494: test +X_TEST495: test +X_TEST496: test +X_TEST497: test +X_TEST498: test +X_TEST499: test +X_TEST500: test +X_TEST501: test +X_TEST502: test +X_TEST503: test +X_TEST504: test +X_TEST505: test +X_TEST506: test +X_TEST507: test +X_TEST508: test +X_TEST509: test +X_TEST510: test +X_TEST511: test +X_TEST512: test +X_TEST513: test +X_TEST514: test +X_TEST515: test +X_TEST516: test +X_TEST517: test +X_TEST518: test +X_TEST519: test +X_TEST520: test +X_TEST521: test +X_TEST522: test +X_TEST523: test +X_TEST524: test +X_TEST525: test +X_TEST526: test +X_TEST527: test +X_TEST528: test +X_TEST529: test +X_TEST530: test +X_TEST531: test +X_TEST532: test +X_TEST533: test +X_TEST534: test +X_TEST535: test +X_TEST536: test +X_TEST537: test +X_TEST538: test +X_TEST539: test +X_TEST540: test +X_TEST541: test +X_TEST542: test +X_TEST543: test +X_TEST544: test +X_TEST545: test +X_TEST546: test +X_TEST547: test +X_TEST548: test +X_TEST549: test +X_TEST550: test +X_TEST551: test +X_TEST552: test +X_TEST553: test +X_TEST554: test +X_TEST555: test +X_TEST556: test +X_TEST557: test +X_TEST558: test +X_TEST559: test +X_TEST560: test +X_TEST561: test +X_TEST562: test +X_TEST563: test +X_TEST564: test +X_TEST565: test +X_TEST566: test +X_TEST567: test +X_TEST568: test +X_TEST569: test +X_TEST570: test +X_TEST571: test +X_TEST572: test +X_TEST573: test +X_TEST574: test +X_TEST575: test +X_TEST576: test +X_TEST577: test +X_TEST578: test +X_TEST579: test +X_TEST580: test +X_TEST581: test +X_TEST582: test +X_TEST583: test +X_TEST584: test +X_TEST585: test +X_TEST586: test +X_TEST587: test +X_TEST588: test +X_TEST589: test +X_TEST590: test +X_TEST591: test +X_TEST592: test +X_TEST593: test +X_TEST594: test +X_TEST595: test +X_TEST596: test +X_TEST597: test +X_TEST598: test +X_TEST599: test +X_TEST600: test +X_TEST601: test +X_TEST602: test +X_TEST603: test +X_TEST604: test +X_TEST605: test +X_TEST606: test +X_TEST607: test +X_TEST608: test +X_TEST609: test +X_TEST610: test +X_TEST611: test +X_TEST612: test +X_TEST613: test +X_TEST614: test +X_TEST615: test +X_TEST616: test +X_TEST617: test +X_TEST618: test +X_TEST619: test +X_TEST620: test +X_TEST621: test +X_TEST622: test +X_TEST623: test +X_TEST624: test +X_TEST625: test +X_TEST626: test +X_TEST627: test +X_TEST628: test +X_TEST629: test +X_TEST630: test +X_TEST631: test +X_TEST632: test +X_TEST633: test +X_TEST634: test +X_TEST635: test +X_TEST636: test +X_TEST637: test +X_TEST638: test +X_TEST639: test +X_TEST640: test +X_TEST641: test +X_TEST642: test +X_TEST643: test +X_TEST644: test +X_TEST645: test +X_TEST646: test +X_TEST647: test +X_TEST648: test +X_TEST649: test +X_TEST650: test +X_TEST651: test +X_TEST652: test +X_TEST653: test +X_TEST654: test +X_TEST655: test +X_TEST656: test +X_TEST657: test +X_TEST658: test +X_TEST659: test +X_TEST660: test +X_TEST661: test +X_TEST662: test +X_TEST663: test +X_TEST664: test +X_TEST665: test +X_TEST666: test +X_TEST667: test +X_TEST668: test +X_TEST669: test +X_TEST670: test +X_TEST671: test +X_TEST672: test +X_TEST673: test +X_TEST674: test +X_TEST675: test +X_TEST676: test +X_TEST677: test +X_TEST678: test +X_TEST679: test +X_TEST680: test +X_TEST681: test +X_TEST682: test +X_TEST683: test +X_TEST684: test +X_TEST685: test +X_TEST686: test +X_TEST687: test +X_TEST688: test +X_TEST689: test +X_TEST690: test +X_TEST691: test +X_TEST692: test +X_TEST693: test +X_TEST694: test +X_TEST695: test +X_TEST696: test +X_TEST697: test +X_TEST698: test +X_TEST699: test +X_TEST700: test +X_TEST701: test +X_TEST702: test +X_TEST703: test +X_TEST704: test +X_TEST705: test +X_TEST706: test +X_TEST707: test +X_TEST708: test +X_TEST709: test +X_TEST710: test +X_TEST711: test +X_TEST712: test +X_TEST713: test +X_TEST714: test +X_TEST715: test +X_TEST716: test +X_TEST717: test +X_TEST718: test +X_TEST719: test +X_TEST720: test +X_TEST721: test +X_TEST722: test +X_TEST723: test +X_TEST724: test +X_TEST725: test +X_TEST726: test +X_TEST727: test +X_TEST728: test +X_TEST729: test +X_TEST730: test +X_TEST731: test +X_TEST732: test +X_TEST733: test +X_TEST734: test +X_TEST735: test +X_TEST736: test +X_TEST737: test +X_TEST738: test +X_TEST739: test +X_TEST740: test +X_TEST741: test +X_TEST742: test +X_TEST743: test +X_TEST744: test +X_TEST745: test +X_TEST746: test +X_TEST747: test +X_TEST748: test +X_TEST749: test +X_TEST750: test +X_TEST751: test +X_TEST752: test +X_TEST753: test +X_TEST754: test +X_TEST755: test +X_TEST756: test +X_TEST757: test +X_TEST758: test +X_TEST759: test +X_TEST760: test +X_TEST761: test +X_TEST762: test +X_TEST763: test +X_TEST764: test +X_TEST765: test +X_TEST766: test +X_TEST767: test +X_TEST768: test +X_TEST769: test +X_TEST770: test +X_TEST771: test +X_TEST772: test +X_TEST773: test +X_TEST774: test +X_TEST775: test +X_TEST776: test +X_TEST777: test +X_TEST778: test +X_TEST779: test +X_TEST780: test +X_TEST781: test +X_TEST782: test +X_TEST783: test +X_TEST784: test +X_TEST785: test +X_TEST786: test +X_TEST787: test +X_TEST788: test +X_TEST789: test +X_TEST790: test +X_TEST791: test +X_TEST792: test +X_TEST793: test +X_TEST794: test +X_TEST795: test +X_TEST796: test +X_TEST797: test +X_TEST798: test +X_TEST799: test +X_TEST800: test +X_TEST801: test +X_TEST802: test +X_TEST803: test +X_TEST804: test +X_TEST805: test +X_TEST806: test +X_TEST807: test +X_TEST808: test +X_TEST809: test +X_TEST810: test +X_TEST811: test +X_TEST812: test +X_TEST813: test +X_TEST814: test +X_TEST815: test +X_TEST816: test +X_TEST817: test +X_TEST818: test +X_TEST819: test +X_TEST820: test +X_TEST821: test +X_TEST822: test +X_TEST823: test +X_TEST824: test +X_TEST825: test +X_TEST826: test +X_TEST827: test +X_TEST828: test +X_TEST829: test +X_TEST830: test +X_TEST831: test +X_TEST832: test +X_TEST833: test +X_TEST834: test +X_TEST835: test +X_TEST836: test +X_TEST837: test +X_TEST838: test +X_TEST839: test +X_TEST840: test +X_TEST841: test +X_TEST842: test +X_TEST843: test +X_TEST844: test +X_TEST845: test +X_TEST846: test +X_TEST847: test +X_TEST848: test +X_TEST849: test +X_TEST850: test +X_TEST851: test +X_TEST852: test +X_TEST853: test +X_TEST854: test +X_TEST855: test +X_TEST856: test +X_TEST857: test +X_TEST858: test +X_TEST859: test +X_TEST860: test +X_TEST861: test +X_TEST862: test +X_TEST863: test +X_TEST864: test +X_TEST865: test +X_TEST866: test +X_TEST867: test +X_TEST868: test +X_TEST869: test +X_TEST870: test +X_TEST871: test +X_TEST872: test +X_TEST873: test +X_TEST874: test +X_TEST875: test +X_TEST876: test +X_TEST877: test +X_TEST878: test +X_TEST879: test +X_TEST880: test +X_TEST881: test +X_TEST882: test +X_TEST883: test +X_TEST884: test +X_TEST885: test +X_TEST886: test +X_TEST887: test +X_TEST888: test +X_TEST889: test +X_TEST890: test +X_TEST891: test +X_TEST892: test +X_TEST893: test +X_TEST894: test +X_TEST895: test +X_TEST896: test +X_TEST897: test +X_TEST898: test +X_TEST899: test +X_TEST900: test +X_TEST901: test +X_TEST902: test +X_TEST903: test +X_TEST904: test +X_TEST905: test +X_TEST906: test +X_TEST907: test +X_TEST908: test +X_TEST909: test +X_TEST910: test +X_TEST911: test +X_TEST912: test +X_TEST913: test +X_TEST914: test +X_TEST915: test +X_TEST916: test +X_TEST917: test +X_TEST918: test +X_TEST919: test +X_TEST920: test +X_TEST921: test +X_TEST922: test +X_TEST923: test +X_TEST924: test +X_TEST925: test +X_TEST926: test +X_TEST927: test +X_TEST928: test +X_TEST929: test +X_TEST930: test +X_TEST931: test +X_TEST932: test +X_TEST933: test +X_TEST934: test +X_TEST935: test +X_TEST936: test +X_TEST937: test +X_TEST938: test +X_TEST939: test +X_TEST940: test +X_TEST941: test +X_TEST942: test +X_TEST943: test +X_TEST944: test +X_TEST945: test +X_TEST946: test +X_TEST947: test +X_TEST948: test +X_TEST949: test +X_TEST950: test +X_TEST951: test +X_TEST952: test +X_TEST953: test +X_TEST954: test +X_TEST955: test +X_TEST956: test +X_TEST957: test +X_TEST958: test +X_TEST959: test +X_TEST960: test +X_TEST961: test +X_TEST962: test +X_TEST963: test +X_TEST964: test +X_TEST965: test +X_TEST966: test +X_TEST967: test +X_TEST968: test +X_TEST969: test +X_TEST970: test +X_TEST971: test +X_TEST972: test +X_TEST973: test +X_TEST974: test +X_TEST975: test +X_TEST976: test +X_TEST977: test +X_TEST978: test +X_TEST979: test +X_TEST980: test +X_TEST981: test +X_TEST982: test +X_TEST983: test +X_TEST984: test +X_TEST985: test +X_TEST986: test +X_TEST987: test +X_TEST988: test +X_TEST989: test +X_TEST990: test +X_TEST991: test +X_TEST992: test +X_TEST993: test +X_TEST994: test +X_TEST995: test +X_TEST996: test +X_TEST997: test +X_TEST998: test +X_TEST999: test diff --git a/tests/simple_server_function_test/response_file/invalid_header_size.txt b/tests/simple_server_function_test/response_file/invalid_header_size.txt new file mode 100644 index 0000000..118f9dc --- /dev/null +++ b/tests/simple_server_function_test/response_file/invalid_header_size.txt @@ -0,0 +1,5 @@ +HTTP/1.1 400 Bad Request +Connection: close +Content-Length: 11 + +Bad Request \ No newline at end of file From 4a7aa6d6e39e9d48c403a99e3730618872a703bc Mon Sep 17 00:00:00 2001 From: taiphyyy Date: Sat, 2 Mar 2024 16:26:33 +0900 Subject: [PATCH 02/10] Validates invalid size of request header --- inc/Request.hpp | 2 ++ src/request/Request.cpp | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/inc/Request.hpp b/inc/Request.hpp index 4bac4b8..8606c4b 100644 --- a/inc/Request.hpp +++ b/inc/Request.hpp @@ -1,6 +1,8 @@ #ifndef REQUEST_HPP #define REQUEST_HPP +#define REQUEST_HEADER_LIMITATION 1000 + #include #include diff --git a/src/request/Request.cpp b/src/request/Request.cpp index f10d946..8d896a9 100644 --- a/src/request/Request.cpp +++ b/src/request/Request.cpp @@ -190,6 +190,14 @@ ClientSocket::csphase Request::load(std::stringstream &buffer) { nextcsphase = ClientSocket::RECV; break; } + if (this->_header.size() > REQUEST_HEADER_LIMITATION - 1) { + this->_method.clear(); + this->_path.clear(); + this->_httpVersion.clear(); + this->_phase = Request::RQFIN; + nextcsphase = ClientSocket::RECV; + break; + } line = utils::rmCR(line); std::stringstream ss(line); std::string key; From f04d36c6e21a7f565cb4bf90984315bfdbac5b44 Mon Sep 17 00:00:00 2001 From: taiphyyy Date: Sat, 2 Mar 2024 16:43:26 +0900 Subject: [PATCH 03/10] Limit size of CGI response header --- inc/Response.hpp | 1 + src/response/Response.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/inc/Response.hpp b/inc/Response.hpp index 5449130..6eb1a23 100644 --- a/inc/Response.hpp +++ b/inc/Response.hpp @@ -6,6 +6,7 @@ #define HTTP_VERSION "HTTP/1.1" #define STATUS_OK "200" #define STATUS_CREATED "201" +#define RESPONSE_HEADER_LIMITATION 1000 #include #include diff --git a/src/response/Response.cpp b/src/response/Response.cpp index 757639b..c59b8ea 100644 --- a/src/response/Response.cpp +++ b/src/response/Response.cpp @@ -458,6 +458,10 @@ void Response::_setCGIResponseHeader(const bool shouldKeepAlive) { std::getline(hss, key, ':'); hss >> std::ws; std::getline(hss, value); + if (this->_headers.size() > RESPONSE_HEADER_LIMITATION - 1) { + this->_headers.clear(); + return ; + } this->_headers.insert(std::pair(key, value)); } std::streampos endPos = ss.tellg(); From f5d2a3c35b16804e6b4774874c2c404078d8bc9e Mon Sep 17 00:00:00 2001 From: taiphyyy Date: Sat, 2 Mar 2024 16:43:59 +0900 Subject: [PATCH 04/10] Test size of cgi response header --- .../cgi_invalid_size_of_header.txt | 7 +++++ .../cgi_invalid_size_of_header.txt | 28 +++++++++++++++++++ .../www/cgi-bin/invalid_size_of_header.py | 26 +++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 tests/simple_server_function_test/request_file/cgi_invalid_size_of_header.txt create mode 100644 tests/simple_server_function_test/response_file/cgi_invalid_size_of_header.txt create mode 100755 tests/simple_server_function_test/www/cgi-bin/invalid_size_of_header.py diff --git a/tests/simple_server_function_test/request_file/cgi_invalid_size_of_header.txt b/tests/simple_server_function_test/request_file/cgi_invalid_size_of_header.txt new file mode 100644 index 0000000..8629b27 --- /dev/null +++ b/tests/simple_server_function_test/request_file/cgi_invalid_size_of_header.txt @@ -0,0 +1,7 @@ +host, localhost +port, 8080 + + +GET /cgi-bin/invalid_size_of_header.py HTTP/1.1 +Host: test +Connection: close \ No newline at end of file diff --git a/tests/simple_server_function_test/response_file/cgi_invalid_size_of_header.txt b/tests/simple_server_function_test/response_file/cgi_invalid_size_of_header.txt new file mode 100644 index 0000000..bb0ff20 --- /dev/null +++ b/tests/simple_server_function_test/response_file/cgi_invalid_size_of_header.txt @@ -0,0 +1,28 @@ +HTTP/1.1 500 Internal Server Error +Connection: close +Content-Length: 620 + + + + + + Error 500 - %{HOSTNAME} + + + + + +
+

Error 500 - Internal Server Error

+

The 500 (Internal Server Error) status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the request.

+
+ + \ No newline at end of file diff --git a/tests/simple_server_function_test/www/cgi-bin/invalid_size_of_header.py b/tests/simple_server_function_test/www/cgi-bin/invalid_size_of_header.py new file mode 100755 index 0000000..b6c2038 --- /dev/null +++ b/tests/simple_server_function_test/www/cgi-bin/invalid_size_of_header.py @@ -0,0 +1,26 @@ +import os + +# ステータスとコンテントタイプのヘッダーを出力 +print("Status: 200 OK") +print("Content-Type: text/html") +for i in range(1000): + print("X_TEST{}: test".format(i)) +print() # ヘッダーの終わりを示す空行 + +print("") +print("") +print("") +print("CGI Environment Variables") +print("") +print("") +print("

Environment Variables

") +print("") +print("") + +# 環境変数を取得してテーブルに表示 +# for key, value in os.environ.items(): +# print(f"") + +print("
VariableValue
{key}{value}
") +print("") +print("") From fb381c234c183d79322f0b575ddb3886aa81a233 Mon Sep 17 00:00:00 2001 From: taiphyyy Date: Sat, 2 Mar 2024 17:24:11 +0900 Subject: [PATCH 05/10] Test too much long header stirng --- .../request_file/invalid_too_much_long_header_value.txt | 8 ++++++++ .../response_file/invalid_too_much_long_header_value.txt | 5 +++++ 2 files changed, 13 insertions(+) create mode 100644 tests/simple_server_function_test/request_file/invalid_too_much_long_header_value.txt create mode 100644 tests/simple_server_function_test/response_file/invalid_too_much_long_header_value.txt diff --git a/tests/simple_server_function_test/request_file/invalid_too_much_long_header_value.txt b/tests/simple_server_function_test/request_file/invalid_too_much_long_header_value.txt new file mode 100644 index 0000000..737a4f2 --- /dev/null +++ b/tests/simple_server_function_test/request_file/invalid_too_much_long_header_value.txt @@ -0,0 +1,8 @@ +host, localhost +port, 8080 + + +GET / HTTP/1.1 +Host: test1 +Connection: close +X_TEST:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ No newline at end of file diff --git a/tests/simple_server_function_test/response_file/invalid_too_much_long_header_value.txt b/tests/simple_server_function_test/response_file/invalid_too_much_long_header_value.txt new file mode 100644 index 0000000..118f9dc --- /dev/null +++ b/tests/simple_server_function_test/response_file/invalid_too_much_long_header_value.txt @@ -0,0 +1,5 @@ +HTTP/1.1 400 Bad Request +Connection: close +Content-Length: 11 + +Bad Request \ No newline at end of file From 8ef5e81530aaee3f89a0baadd94602d7e4ae9a4f Mon Sep 17 00:00:00 2001 From: taiphyyy Date: Sat, 2 Mar 2024 17:24:44 +0900 Subject: [PATCH 06/10] Validate too much long header and request line size --- inc/ClientSocket.hpp | 1 + src/loop/loop.cpp | 5 ++++- src/sockets/ClientSocket.cpp | 12 ++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/inc/ClientSocket.hpp b/inc/ClientSocket.hpp index 0541176..363b29b 100644 --- a/inc/ClientSocket.hpp +++ b/inc/ClientSocket.hpp @@ -42,6 +42,7 @@ class ClientSocket { void setLastSendTimestamp(std::time_t const lastSendTimestamp); bool findCRLF(); ServerSocket *getServerSocket() const; + bool isOverBytesSize(const std::stringstream::pos_type bytes); }; #endif diff --git a/src/loop/loop.cpp b/src/loop/loop.cpp index c2540a8..0b718dd 100644 --- a/src/loop/loop.cpp +++ b/src/loop/loop.cpp @@ -176,7 +176,10 @@ bool loop(std::map &ssmap, Config &config) { csiter->second->getPhase() == ClientSocket::CLOSE) { continue; } - if ((utils::findLF(csiter->second->buffer) || + if (iter->second.getReqphase() != Request::RQBODY && csiter->second->isOverBytesSize(1000) == true) { + iter->second.init(); + iter->second.setReqphase(Request::RQFIN); + } else if ((utils::findLF(csiter->second->buffer) || iter->second.getReqphase() == Request::RQBODY)) { ClientSocket::csphase nextcsphase = iter->second.load(csiter->second->buffer); diff --git a/src/sockets/ClientSocket.cpp b/src/sockets/ClientSocket.cpp index babeae5..c0b964b 100644 --- a/src/sockets/ClientSocket.cpp +++ b/src/sockets/ClientSocket.cpp @@ -108,4 +108,16 @@ void ClientSocket::setLastSendTimestamp(std::time_t const lastSendTimestamp) { ServerSocket *ClientSocket::getServerSocket() const { return this->_serverSocket; +} + +bool ClientSocket::isOverBytesSize(const std::stringstream::pos_type bytes) { + std::stringstream::pos_type posStart = this->buffer.tellg(); + this->buffer.seekg(0, std::ios::end); + std::stringstream::pos_type posEnd = this->buffer.tellg(); + if (posEnd - posEnd > bytes) { + this->buffer.seekg(posStart); + return true; + } + this->buffer.seekg(posStart); + return false; } \ No newline at end of file From 09a2a1589916196a2ba75fb42c7b1ace234f63f0 Mon Sep 17 00:00:00 2001 From: taiphyyy Date: Sat, 2 Mar 2024 17:40:21 +0900 Subject: [PATCH 07/10] Test too much long header value string --- ...cgi_invalid_too_much_long_header_value.txt | 7 +++++ ...cgi_invalid_too_much_long_header_value.txt | 28 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 tests/simple_server_function_test/request_file/cgi_invalid_too_much_long_header_value.txt create mode 100644 tests/simple_server_function_test/response_file/cgi_invalid_too_much_long_header_value.txt diff --git a/tests/simple_server_function_test/request_file/cgi_invalid_too_much_long_header_value.txt b/tests/simple_server_function_test/request_file/cgi_invalid_too_much_long_header_value.txt new file mode 100644 index 0000000..4d95a19 --- /dev/null +++ b/tests/simple_server_function_test/request_file/cgi_invalid_too_much_long_header_value.txt @@ -0,0 +1,7 @@ +host, localhost +port, 8080 + + +GET /cgi-bin/too_much_long_header_value.py HTTP/1.1 +Host: test +Connection: close \ No newline at end of file diff --git a/tests/simple_server_function_test/response_file/cgi_invalid_too_much_long_header_value.txt b/tests/simple_server_function_test/response_file/cgi_invalid_too_much_long_header_value.txt new file mode 100644 index 0000000..bb0ff20 --- /dev/null +++ b/tests/simple_server_function_test/response_file/cgi_invalid_too_much_long_header_value.txt @@ -0,0 +1,28 @@ +HTTP/1.1 500 Internal Server Error +Connection: close +Content-Length: 620 + + + + + + Error 500 - %{HOSTNAME} + + + + + +
+

Error 500 - Internal Server Error

+

The 500 (Internal Server Error) status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the request.

+
+ + \ No newline at end of file From 6248b18dcce51ca9ee5d9aebfaf012cc9b569d66 Mon Sep 17 00:00:00 2001 From: taiphyyy Date: Sat, 2 Mar 2024 17:40:42 +0900 Subject: [PATCH 08/10] Test too much long header value string --- .../www/cgi-bin/too_much_long_header_value.py | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 tests/simple_server_function_test/www/cgi-bin/too_much_long_header_value.py diff --git a/tests/simple_server_function_test/www/cgi-bin/too_much_long_header_value.py b/tests/simple_server_function_test/www/cgi-bin/too_much_long_header_value.py new file mode 100755 index 0000000..9c9d205 --- /dev/null +++ b/tests/simple_server_function_test/www/cgi-bin/too_much_long_header_value.py @@ -0,0 +1,25 @@ +import os + +# ステータスとコンテントタイプのヘッダーを出力 +print("Status: 200 OK") +print("Content-Type: text/html") +print("X_TEST:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") +print() # ヘッダーの終わりを示す空行 + +print("") +print("") +print("") +print("CGI Environment Variables") +print("") +print("") +print("

Environment Variables

") +print("") +print("") + +# 環境変数を取得してテーブルに表示 +# for key, value in os.environ.items(): +# print(f"") + +print("
VariableValue
{key}{value}
") +print("") +print("") From 7788b7cc52d5785e016e9859e2e9ba66f00521b6 Mon Sep 17 00:00:00 2001 From: taiphyyy Date: Sat, 2 Mar 2024 17:40:54 +0900 Subject: [PATCH 09/10] validate too much long header value string --- src/response/Response.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/response/Response.cpp b/src/response/Response.cpp index c59b8ea..b39a820 100644 --- a/src/response/Response.cpp +++ b/src/response/Response.cpp @@ -565,6 +565,14 @@ ClientSocket::csphase Response::_setCGIResponse(Request &request, break; } case CGIHandler::CGISET: { + if (this->_cgiHandler.getRbuffer().size() > 1000) { + this->_headers.clear(); + this->_body.clear(); + this->_setErrorResponse("500", false); + this->_cgiHandler.setCGIPhase(CGIHandler::CGIFIN); + this->setRawData(); + break; + } this->_setCGIResponseHeader(shouldKeepAlive); this->_setCGIResponseBody(); this->_setCGIResponseStatus(); From 1425d72a4f071fab4bfa4fe069c4a6342019e91a Mon Sep 17 00:00:00 2001 From: taiphyyy Date: Sat, 2 Mar 2024 18:13:05 +0900 Subject: [PATCH 10/10] bug fix over limit data size in request line and add test --- src/loop/loop.cpp | 2 +- src/request/Request.cpp | 16 ++++++++++++++++ src/sockets/ClientSocket.cpp | 2 +- .../invalid_too_much_long_request_line.txt | 7 +++++++ .../invalid_too_much_long_request_line.txt | 5 +++++ 5 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 tests/simple_server_function_test/request_file/invalid_too_much_long_request_line.txt create mode 100644 tests/simple_server_function_test/response_file/invalid_too_much_long_request_line.txt diff --git a/src/loop/loop.cpp b/src/loop/loop.cpp index 0b718dd..7711fa4 100644 --- a/src/loop/loop.cpp +++ b/src/loop/loop.cpp @@ -176,7 +176,7 @@ bool loop(std::map &ssmap, Config &config) { csiter->second->getPhase() == ClientSocket::CLOSE) { continue; } - if (iter->second.getReqphase() != Request::RQBODY && csiter->second->isOverBytesSize(1000) == true) { + if (iter->second.getReqphase() != Request::RQBODY && utils::findLF(csiter->second->buffer) == false && csiter->second->isOverBytesSize(1000) == true) { iter->second.init(); iter->second.setReqphase(Request::RQFIN); } else if ((utils::findLF(csiter->second->buffer) || diff --git a/src/request/Request.cpp b/src/request/Request.cpp index 8d896a9..a9fef93 100644 --- a/src/request/Request.cpp +++ b/src/request/Request.cpp @@ -147,6 +147,14 @@ ClientSocket::csphase Request::load(std::stringstream &buffer) { case Request::RQLINE: { std::string line; std::getline(buffer, line); + if (line.size() > 1000) { + this->_method.clear(); + this->_path.clear(); + this->_httpVersion.clear(); + this->_phase = Request::RQFIN; + nextcsphase = ClientSocket::RECV; + break; + } if (line.compare("\r") == 0) { this->_phase = Request::RQLINE; nextcsphase = ClientSocket::RECV; @@ -177,6 +185,14 @@ ClientSocket::csphase Request::load(std::stringstream &buffer) { case Request::RQHEADER: { std::string line; std::getline(buffer, line); + if (line.size() > 1000) { + this->_method.clear(); + this->_path.clear(); + this->_httpVersion.clear(); + this->_phase = Request::RQFIN; + nextcsphase = ClientSocket::RECV; + break; + } if (line.compare("\r") == 0) { this->_phase = Request::RQBODY; nextcsphase = ClientSocket::RECV; diff --git a/src/sockets/ClientSocket.cpp b/src/sockets/ClientSocket.cpp index c0b964b..2680da6 100644 --- a/src/sockets/ClientSocket.cpp +++ b/src/sockets/ClientSocket.cpp @@ -114,7 +114,7 @@ bool ClientSocket::isOverBytesSize(const std::stringstream::pos_type bytes) { std::stringstream::pos_type posStart = this->buffer.tellg(); this->buffer.seekg(0, std::ios::end); std::stringstream::pos_type posEnd = this->buffer.tellg(); - if (posEnd - posEnd > bytes) { + if (posEnd - posStart > bytes) { this->buffer.seekg(posStart); return true; } diff --git a/tests/simple_server_function_test/request_file/invalid_too_much_long_request_line.txt b/tests/simple_server_function_test/request_file/invalid_too_much_long_request_line.txt new file mode 100644 index 0000000..a9fb62a --- /dev/null +++ b/tests/simple_server_function_test/request_file/invalid_too_much_long_request_line.txt @@ -0,0 +1,7 @@ +host, localhost +port, 8080 + + +GET /aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa HTTP/1.1 +Host: test1 +Connection: close \ No newline at end of file diff --git a/tests/simple_server_function_test/response_file/invalid_too_much_long_request_line.txt b/tests/simple_server_function_test/response_file/invalid_too_much_long_request_line.txt new file mode 100644 index 0000000..118f9dc --- /dev/null +++ b/tests/simple_server_function_test/response_file/invalid_too_much_long_request_line.txt @@ -0,0 +1,5 @@ +HTTP/1.1 400 Bad Request +Connection: close +Content-Length: 11 + +Bad Request \ No newline at end of file