thecatalinstan / Criollo

A powerful Cocoa web framework and HTTP server for macOS, iOS and tvOS.
https://criollo.io/
MIT License
290 stars 51 forks source link

iOS :Uncaught exception: NSInternalInconsistencyException: Response is already finished #109

Open chillin0531 opened 1 year ago

chillin0531 commented 1 year ago

In iOS, I'm trying to mount a directory and launch a html file in it. If I mount a single directory to a path and load the html content and there is no issues. If I try to mount more than one folder into the same path then I get the "NSInternalInconsistencyException" while trying to load the files in the folder that was mounted later. For example, I have folder_A and I mount with the path /test_A and if I access the file with URL "/test_A/index.html", no issues. If a folder_A and folder_B is mounted with path /test_A and /test_B respectively and try to access the files in /test_B then I get the following exception.

Uncaught exception: NSInternalInconsistencyException: Response is already finished ( 0 CoreFoundation 0x00000001828f9d8c D2716F2F-688B-3D51-BA8B-17E6553B209E + 630156 1 libobjc.A.dylib 0x000000019b55e734 objc_exception_throw + 60 2 Criollo 0x000000010321d258 -[CRHTTPResponse finish] + 0 3 Criollo 0x0000000103223990 -[CRResponse sendString:] + 52 4 Criollo 0x0000000103229734 112+[CRStaticDirectoryManager indexBlockForDirectoryAtPath:requestedPath:prefix:displayParentLink:showHiddenFiles:]_block_invoke + 728 5 Criollo 0x0000000103228ecc 67-[CRStaticDirectoryManager initWithDirectoryAtPath:prefix:options:]_block_invoke + 688 6 Criollo 0x00000001032265a4 -[CRRouter executeRoutes:forRequest:response:withCompletion:notFoundBlock:] + 784 7 Criollo 0x0000000103227d4c __50-[CRServer connection:didReceiveRequest:response:]_block_invoke + 216 8 Foundation 0x000000018409ea9c FEEEF9B1-B0E6-3561-ADFA-3EF0302D23F8 + 330396 9 Foundation 0x00000001840b0e14 FEEEF9B1-B0E6-3561-ADFA-3EF0302D23F8 + 405012 10 Foundation 0x00000001840891c4 FEEEF9B1-B0E6-3561-ADFA-3EF0302D23F8 + 242116 11 Foundation 0x000000018409a4e0 FEEEF9B1-B0E6-3561-ADFA-3EF0302D23F8 + 312544 12 Foundation 0x000000018409dae8 FEEEF9B1-B0E6-3561-ADFA-3EF0302D23F8 + 326376 13 Foundation 0x00000001840abc90 FEEEF9B1-B0E6-3561-ADFA-3EF0302D23F8 + 384144 14 libdispatch.dylib 0x000000018256f830 69DAC9C7-DDAF-318E-B068-BE596D142A2F + 75824 15 libdispatch.dylib 0x0000000182560a2c 69DAC9C7-DDAF-318E-B068-BE596D142A2F + 14892 16 libdispatch.dylib 0x0000000182563eec 69DAC9C7-DDAF-318E-B068-BE596D142A2F + 28396 17 libdispatch.dylib 0x0000000182563558 69DAC9C7-DDAF-318E-B068-BE596D142A2F + 25944 18 libdispatch.dylib 0x0000000182572164 69DAC9C7-DDAF-318E-B068-BE596D142A2F + 86372 19 libdispatch.dylib 0x000000018257296c 69DAC9C7-DDAF-318E-B068-BE596D142A2F + 88428 20 libsystem_pthread.dylib 0x00000001f3852080 _pthread_wqthread + 228 21 libsystem_pthread.dylib 0x00000001f3851e5c start_wqthread + 8 ) *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Response is already finished'