hugoprudente / mongoose

Automatically exported from code.google.com/p/mongoose
MIT License
0 stars 0 forks source link

SCRIPT_NAME not usable when cgi is called with path + query string #403

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

What steps will reproduce the problem?
1. create a cgi
2. call it with path + query string http://localhost/test.gci/a/b?c&d
3. examine the SCRIPT_NAME

What is the expected output? What do you see instead?
SCRIPT_NAME is /test.cgi/a/test.cgi
expected /test.cgi

What version of the product are you using? On what operating system?
mongoose v3.8 on windows xp sp3, the cgi is an executable. 

Please provide any additional information below.
Could be related to issue 108?

Original issue reported on code.google.com by Joost.de...@gmail.com on 6 Sep 2013 at 10:29

GoogleCodeExporter commented 9 years ago
Submitted 
https://github.com/valenok/mongoose/commit/e556a487e0a85fd0dd61732732103108ace09
c81

You can try it with the dev executable, 
https://code.google.com/p/mongoose/downloads/detail?name=mongoose_07.09.2013.exe

Please confirm that it works as expected.
Thanks for reporting!

Original comment by valenok on 7 Sep 2013 at 5:52

GoogleCodeExporter commented 9 years ago
Thanks for the quick update!

The original issue with SCRIPT_NAME is gone.
Unfortunately, now mongoose crashes on cleanup (after the cgi is finished and 
the request handled).

The 'access violation' on cleanup also happens with a static page.
The 19.08.2013 version does not have this crash.

Here is the stack trace:
>   kernel32.dll!7c830cb3()     
    [Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]  
    mongoose_07.09.2013.exe!0040847e()  
    mongoose_07.09.2013.exe!00408335()  
    ntdll.dll!7c90da2a()    
    kernel32.dll!7c8024c7()     
    msvcrt.dll!77c4aeff()   
    mongoose_07.09.2013.exe!00408147()  
    msvcrt.dll!77c3a243()   
    kernel32.dll!7c80b729()     

Let me know if I can provide you with more information.

With kind regards,
Joost de Greef.

Original comment by Joost.de...@gmail.com on 7 Sep 2013 at 7:55

GoogleCodeExporter commented 9 years ago
Thanks!

Does crash happen with https://mongoose.googlecode.com/files/mongoose-4.0.exe 
too ?
I am testing it under Wine on MacOS, with XP emulation, I see no crash.
I'd appreciate if you help me debug this.

Do you have access on other Windows platform, e.g. Windows 7? 

Original comment by valenok on 7 Sep 2013 at 8:03

GoogleCodeExporter commented 9 years ago
the 4.0 version has the same issue here (on windows xp 32 bit):

>    kernel32.dll!7c830cb3()    
     [Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]   
     mongoose-4.0.exe!0040847e()    
     mongoose-4.0.exe!00408335()    
     ntdll.dll!7c90da2a()    
     kernel32.dll!7c8024c7()    
     msvcrt.dll!77c4aeff()    
     mongoose-4.0.exe!00408147()    
     msvcrt.dll!77c3a243()    
     kernel32.dll!7c80b729()    

On windows 7 64 bit the stack trace shows the same address:
>    KernelBase.dll!LockFileEx()  + 0x32 bytes   
     [Frames below may be incorrect and/or missing, no symbols loaded for KernelBase.dll]   
     mongoose-4.0.exe!0040847e()    
     mongoose-4.0.exe!00408335()    
     ntdll.dll!NtReleaseMutant()  + 0x15 bytes   
     026fd838()   
     mongoose-4.0.exe!00408183()    
     msvcrt.dll!_beginthread()  + 0xf2 bytes   
     msvcrt.dll!_beginthread()  + 0xd1 bytes   
     kernel32.dll!BaseThreadInitThunk()  + 0x12 bytes   
     ntdll.dll!RtlInitializeExceptionChain()  + 0x63 bytes   
     ntdll.dll!RtlInitializeExceptionChain()  + 0x36 bytes   

sounds like a nice challenge :-)
sorry for replying like this, the email reply came back :-/

Original comment by Joost.de...@gmail.com on 7 Sep 2013 at 8:20

GoogleCodeExporter commented 9 years ago
Thanks. I suspect flockfile() change is guilty.
Did you configure access/error logging?
Can you share your config file / command line options please?

Original comment by valenok on 7 Sep 2013 at 8:44

GoogleCodeExporter commented 9 years ago
Could you try this binary please: 
https://code.google.com/p/mongoose/downloads/detail?name=mongoose-tiny.07.09.201
3.exe

Original comment by valenok on 7 Sep 2013 at 8:55

GoogleCodeExporter commented 9 years ago
i also think the error is in the locking:
//#define flockfile(x) LockFileEx((HANDLE) _get_osfhandle(_fileno(x)), \
//  LOCKFILE_FAIL_IMMEDIATELY | LOCKFILE_EXCLUSIVE_LOCK, 0, 0, 0, NULL)
//#define funlockfile(x) UnlockFileEx((HANDLE) _get_osfhandle(_fileno(x)), \
//                                                            0, 0, 0, NULL)
#define flockfile(x) LockFile((HANDLE) _get_osfhandle(_fileno(x)), 0, 0, 0, 0)
#define funlockfile(x) UnlockFileEx((HANDLE) _get_osfhandle(_fileno(x)), 0, 0, 
0, 0)
The second version 'works', even though it doesn't lock any bytes :-)
Testing the new build you posted now.

Original comment by Joost.de...@gmail.com on 7 Sep 2013 at 9:29

GoogleCodeExporter commented 9 years ago
The new 4.1 version you posted works fine!

Thanks a lot!

Original comment by Joost.de...@gmail.com on 7 Sep 2013 at 9:32

GoogleCodeExporter commented 9 years ago
You're welcome, and thank you!
Let me know if you have any more questions, or need help with Mongoose!

Original comment by valenok on 7 Sep 2013 at 9:48