ap_lua_binstrstr: Binary strstr function for uploaded data with NULL bytes */
| 363 | |
| 364 | /* ap_lua_binstrstr: Binary strstr function for uploaded data with NULL bytes */ |
| 365 | static char* ap_lua_binstrstr (const char * haystack, size_t hsize, const char* needle, size_t nsize) |
| 366 | { |
| 367 | size_t p; |
| 368 | if (haystack == NULL) return NULL; |
| 369 | if (needle == NULL) return NULL; |
| 370 | if (hsize < nsize) return NULL; |
| 371 | for (p = 0; p <= (hsize - nsize); ++p) { |
| 372 | if (memcmp(haystack + p, needle, nsize) == 0) { |
| 373 | return (char*) (haystack + p); |
| 374 | } |
| 375 | } |
| 376 | return NULL; |
| 377 | } |
| 378 | |
| 379 | /* r:parsebody(): Parses regular (url-enocded) or multipart POST data and returns two tables*/ |
| 380 | static int req_parsebody(lua_State *L) |