View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0001594 | libmicrohttpd | other | public | 2010-07-30 06:17 | 2010-09-10 15:32 |
| Reporter | d4de | Assigned To | Christian Grothoff | ||
| Priority | normal | Severity | major | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Product Version | 0.9.0 | ||||
| Summary | 0001594: https_fileserver_example.c fails to send any file content and always responds with 404 | ||||
| Description | The example was checking the existence of the file before actually opening it and reading its contents into memory, but the erroneous line below shows that it passes the `url' as a pointer to a string like "/file.html", so when stat looks up this file for other information, it exists with ENOENT, and effectively results in 404 response sent back to the client. - if ( (0 == stat (url, &buf)) && The fix for this is very simple, instead we just pass the pointer address for the second character on wards, so now it is looking at the current directory instead of `/'. + if ( (0 == stat (&url[1], &buf)) && | ||||
| Additional Information | Please see attached a patch for this bug. | ||||
| Tags | No tags attached. | ||||
| Attached Files | https_fileserver_example.c.patch (413 bytes)
--- libmicrohttpd/src/examples/https_fileserver_example.c.orig 2010-07-24 15:24:50.000000000 +0000
+++ libmicrohttpd/src/examples/https_fileserver_example.c 2010-07-29 20:32:16.000000000 +0000
@@ -138,5 +138,5 @@
*ptr = NULL; /* reset when done */
- if ( (0 == stat (url, &buf)) &&
+ if ( (0 == stat (&url[1], &buf)) &&
(S_ISREG (buf.st_mode)) )
file = fopen (&url[1], "rb");
| ||||
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2010-07-30 06:17 | d4de | New Issue | |
| 2010-07-30 06:17 | d4de | File Added: https_fileserver_example.c.patch | |
| 2010-07-30 06:53 | Christian Grothoff | Note Added: 0004094 | |
| 2010-07-30 06:53 | Christian Grothoff | Status | new => resolved |
| 2010-07-30 06:53 | Christian Grothoff | Resolution | open => fixed |
| 2010-07-30 06:53 | Christian Grothoff | Assigned To | => Christian Grothoff |
| 2010-09-10 15:32 | Christian Grothoff | Status | resolved => closed |