Lines Matching full:if
29 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
58 * headers automatically based on the extension of the file being served. If
87 * The list of supported file types is quite short, so if makefsdata complains
105 #if LWIP_TCP && LWIP_CALLBACK_API
111 #if LWIP_HTTPD_SUPPORT_11_KEEPALIVE
122 #if LWIP_HTTPD_SSI
126 /** Default: don't copy if the data is sent from file-system directly */
160 #if LWIP_HTTPD_SUPPORT_REQUESTLIST
165 #if LWIP_HTTPD_SUPPORT_POST
166 #if LWIP_HTTPD_POST_MAX_RESPONSE_URI_LEN > LWIP_HTTPD_MAX_REQUEST_URI_LEN
173 #if LWIP_HTTPD_URI_BUF_LEN
179 #if LWIP_HTTPD_DYNAMIC_HEADERS
199 #if LWIP_HTTPD_SSI
213 #if !LWIP_HTTPD_SSI_INCLUDE_TAG
220 #if LWIP_HTTPD_SSI_MULTIPART
231 #if LWIP_HTTPD_KILL_OLD_ON_CONNECTIONS_EXCEEDED
239 #if LWIP_HTTPD_SUPPORT_REQUESTLIST
243 #if LWIP_HTTPD_DYNAMIC_FILE_READ
249 #if LWIP_HTTPD_SUPPORT_11_KEEPALIVE
252 #if LWIP_HTTPD_SSI
255 #if LWIP_HTTPD_CGI
259 #if LWIP_HTTPD_DYNAMIC_HEADERS
266 #if LWIP_HTTPD_TIMING
269 #if LWIP_HTTPD_SUPPORT_POST
271 #if LWIP_HTTPD_POST_MANUAL_WND
279 #if HTTPD_USE_MEM_POOL
281 #if LWIP_HTTPD_SSI
291 #if LWIP_HTTPD_SSI
303 #if LWIP_HTTPD_FS_ASYNC_READ
307 #if LWIP_HTTPD_SSI
310 #if !LWIP_HTTPD_SSI_RAW
322 #if LWIP_HTTPD_CGI
334 #if LWIP_HTTPD_KILL_OLD_ON_CONNECTIONS_EXCEEDED
351 if (http_connections) { in http_remove_connection()
352 if (http_connections == hs) { in http_remove_connection()
357 if (last->next == hs) { in http_remove_connection()
372 #if LWIP_HTTPD_SSI in http_kill_oldest_connection()
373 if (ssi_required) { in http_kill_oldest_connection()
374 if (hs->next->ssi != NULL) { in http_kill_oldest_connection()
387 if (hs_free_next != NULL) { in http_kill_oldest_connection()
401 #if LWIP_HTTPD_SSI
407 #if LWIP_HTTPD_KILL_OLD_ON_CONNECTIONS_EXCEEDED in http_ssi_state_alloc()
408 if (ret == NULL) { in http_ssi_state_alloc()
413 if (ret != NULL) { in http_ssi_state_alloc()
423 if (ssi != NULL) { in http_ssi_state_free()
436 #if LWIP_HTTPD_DYNAMIC_HEADERS in http_state_init()
447 #if LWIP_HTTPD_KILL_OLD_ON_CONNECTIONS_EXCEEDED in http_state_alloc()
448 if (ret == NULL) { in http_state_alloc()
453 if (ret != NULL) { in http_state_alloc()
461 * Also frees the file data if dynamic.
466 if(hs->handle) { in http_state_eof()
467 #if LWIP_HTTPD_TIMING in http_state_eof()
476 #if LWIP_HTTPD_DYNAMIC_FILE_READ in http_state_eof()
477 if (hs->buf != NULL) { in http_state_eof()
482 #if LWIP_HTTPD_SSI in http_state_eof()
483 if (hs->ssi) { in http_state_eof()
488 #if LWIP_HTTPD_SUPPORT_REQUESTLIST in http_state_eof()
489 if (hs->req) { in http_state_eof()
497 * Also frees the file data if dynamic.
502 if (hs != NULL) { in http_state_free()
525 if (len == 0) { in http_write()
530 if (max_len < len) { in http_write()
536 if(len > max_len) { in http_write()
543 if (err == ERR_MEM) { in http_write()
544 if ((tcp_sndbuf(pcb) == 0) || in http_write()
556 if (err == ERR_OK) { in http_write()
564 #if LWIP_HTTPD_SUPPORT_11_KEEPALIVE in http_write()
587 #if LWIP_HTTPD_SUPPORT_POST in http_close_or_abort_conn()
588 if (hs != NULL) { in http_close_or_abort_conn()
589 if ((hs->post_content_len_left != 0) in http_close_or_abort_conn()
590 #if LWIP_HTTPD_POST_MANUAL_WND in http_close_or_abort_conn()
607 if (hs != NULL) { in http_close_or_abort_conn()
611 if (abort_conn) { in http_close_or_abort_conn()
616 if (err != ERR_OK) { in http_close_or_abort_conn()
644 #if LWIP_HTTPD_SUPPORT_11_KEEPALIVE in http_eof()
645 if (hs->keepalive) { in http_eof()
663 #if LWIP_HTTPD_CGI || LWIP_HTTPD_CGI_SSI
682 /* If we have no parameters at all, return immediately. */ in extract_uri_parameters()
683 if(!params || (params[0] == '\0')) { in extract_uri_parameters()
691 * remainder (if any) */ in extract_uri_parameters()
703 if(pair) { in extract_uri_parameters()
710 if(pair) { in extract_uri_parameters()
721 if(equals) { in extract_uri_parameters()
733 #if LWIP_HTTPD_SSI
747 #if LWIP_HTTPD_SSI_RAW
754 #if LWIP_HTTPD_SSI_MULTIPART
761 #if LWIP_HTTPD_SSI_MULTIPART
765 #if LWIP_HTTPD_SSI_RAW
769 if(g_pfnSSIHandler
770 #if !LWIP_HTTPD_SSI_RAW
776 #if LWIP_HTTPD_SSI_RAW
780 if(strcmp(ssi->tag_name, g_ppcTags[tag]) == 0)
785 #if LWIP_HTTPD_SSI_MULTIPART
788 #if LWIP_HTTPD_FILE_STATE
792 #if LWIP_HTTPD_SSI_RAW
793 if (ssi->tag_insert_len != HTTPD_SSI_TAG_UNKNOWN)
802 /* If we drop out, we were asked to serve a page which contains tags that
822 #if LWIP_HTTPD_DYNAMIC_HEADERS
844 if (uri == NULL) {
846 #if LWIP_HTTPD_SUPPORT_11_KEEPALIVE
847 if (hs->keepalive) {
864 if (strstr(uri, "404")) {
866 } else if (strstr(uri, "400")) {
868 } else if (strstr(uri, "501")) {
874 /* Determine if the URI has any variables and, if so, temporarily remove
877 if(vars) {
889 if (ext != NULL) {
893 if(!lwip_stricmp(g_psHTTPHeaders[content_type].extension, ext)) {
901 /* Reinstate the parameter marker if there was one in the original URI. */
902 if (vars) {
906 #if LWIP_HTTPD_OMIT_HEADER_FOR_EXTENSIONLESS_URI
907 /* Does the URL passed have any file extension? If not, we assume it
910 if (!ext) {
919 if(content_type < NUM_HTTP_HEADERS) {
922 } else if (!ext) {
930 #if LWIP_HTTPD_SSI
931 if (hs->ssi != NULL) {
935 if ((hs->handle == NULL) ||
939 if (add_content_len) {
944 if (len <= LWIP_HTTPD_MAX_CONTENT_LEN_SIZE - LWIP_HTTPD_MAX_CONTENT_LEN_OFFSET) {
951 #if LWIP_HTTPD_SUPPORT_11_KEEPALIVE
952 if (add_content_len) {
958 if (add_content_len) {
1002 if (hs->hdr_index == HDR_STRINGS_IDX_CONTENT_LEN_NR) {
1006 if (hs->hdr_index < NUM_FILE_HDR_STRINGS - 1) {
1010 if ((err == ERR_OK) && (old_sendlen != sendlen)) {
1013 } else if (err != ERR_OK) {
1023 if(hs->hdr_pos == hdrlen) {
1035 if ((hs->hdr_index >= NUM_FILE_HDR_STRINGS) && (hs->file == NULL)) {
1039 if(http_check_eof(pcb, hs)) {
1043 /* If we get here and there are still header bytes to send, we send
1044 * the header information we just wrote immediately. If there are no
1047 if((hs->hdr_index < NUM_FILE_HDR_STRINGS) || !hs->file) {
1056 * either close the file or read the next block (if supported).
1058 * @returns: 0 if the file is finished or no data has been read
1059 * 1 if the file is not finished and data has been read
1065 #if LWIP_HTTPD_DYNAMIC_FILE_READ
1073 if (hs->handle == NULL) {
1079 if (bytes_left <= 0) {
1085 #if LWIP_HTTPD_DYNAMIC_FILE_READ
1087 if(hs->buf) {
1093 if(bytes_left < count) {
1099 if (count > max_write_len) {
1105 if (hs->buf != NULL) {
1112 /* Did we get a send buffer? If not, return immediately. */
1113 if (hs->buf == NULL) {
1122 #if LWIP_HTTPD_FS_ASYNC_READ
1127 if (count < 0) {
1128 if (count == FS_READ_DELAYED) {
1143 #if LWIP_HTTPD_SSI
1144 if (hs->ssi) {
1172 if (err == ERR_OK) {
1181 #if LWIP_HTTPD_SSI
1205 if(ssi->parsed > hs->file) {
1209 if (err == ERR_OK) {
1215 /* If the send buffer is full, return now. */
1216 if(tcp_sndbuf(pcb) == 0) {
1226 if (len == 0) {
1233 if(*ssi->parsed == g_pcTagLeadIn[0]) {
1238 #if !LWIP_HTTPD_SSI_INCLUDE_TAG
1253 if(ssi->tag_index == LEN_TAG_LEAD_IN) {
1258 if(*ssi->parsed == g_pcTagLeadIn[ssi->tag_index]) {
1280 if((ssi->tag_index == 0) && ((*ssi->parsed == ' ') ||
1291 if((*ssi->parsed == g_pcTagLeadOut[0]) ||
1295 if(ssi->tag_index == 0) {
1305 if(*ssi->parsed == g_pcTagLeadOut[0]) {
1313 if(ssi->tag_index < LWIP_HTTPD_MAX_TAG_NAME_LEN) {
1331 if((ssi->tag_index == 0) && ((*ssi->parsed == ' ') ||
1341 if(*ssi->parsed == g_pcTagLeadOut[ssi->tag_index]) {
1350 if(ssi->tag_index == (LEN_TAG_LEAD_OUT - 1)) {
1353 #if LWIP_HTTPD_SSI_MULTIPART
1364 #if !LWIP_HTTPD_SSI_INCLUDE_TAG
1368 /* If there is any unsent data in the buffer prior to the
1370 if (ssi->tag_end > hs->file) {
1372 #if LWIP_HTTPD_SSI_INCLUDE_TAG
1380 if (err == ERR_OK) {
1382 #if !LWIP_HTTPD_SSI_INCLUDE_TAG
1383 if(ssi->tag_started <= hs->file) {
1412 if(ssi->tag_end > hs->file) {
1414 #if LWIP_HTTPD_SSI_INCLUDE_TAG
1421 if (len != 0) {
1426 if (err == ERR_OK) {
1428 #if !LWIP_HTTPD_SSI_INCLUDE_TAG
1429 if(ssi->tag_started <= hs->file) {
1438 #if LWIP_HTTPD_SSI_MULTIPART
1439 if(ssi->tag_index >= ssi->tag_insert_len) {
1441 if (ssi->tag_part != HTTPD_LAST_TAG_PART) {
1442 /* If so, call it again */
1450 if(ssi->tag_index < ssi->tag_insert_len) {
1456 * single tag insert buffer per connection. If we don't do
1457 * this, insert corruption can occur if more than one insert
1461 if (err == ERR_OK) {
1467 #if LWIP_HTTPD_SSI_MULTIPART
1468 if (ssi->tag_part == HTTPD_LAST_TAG_PART)
1476 #if !LWIP_HTTPD_SSI_INCLUDE_TAG
1488 /* If we drop out of the end of the for loop, this implies we must have
1490 * handled this so skip the send if that's the case. */
1491 if((ssi->tag_state != TAG_SENDING) && (ssi->parsed > hs->file)) {
1495 if (err == ERR_OK) {
1519 #if LWIP_HTTPD_SUPPORT_POST && LWIP_HTTPD_POST_MANUAL_WND
1520 if (hs->unrecved_bytes != 0) {
1525 /* If we were passed a NULL state structure pointer, ignore the call. */
1526 if (hs == NULL) {
1530 #if LWIP_HTTPD_FS_ASYNC_READ
1531 /* Check if we are allowed to read from this file.
1533 if (!fs_is_file_ready(hs->handle, http_continue, hs)) {
1538 #if LWIP_HTTPD_DYNAMIC_HEADERS
1540 if (hs->hdr_index < NUM_FILE_HDR_STRINGS) {
1542 if ((data_to_send != HTTP_DATA_TO_SEND_CONTINUE) &&
1549 /* Have we run out of file data to send? If so, we need to read the next
1551 if (hs->left == 0) {
1552 if (!http_check_eof(pcb, hs)) {
1557 #if LWIP_HTTPD_SSI
1558 if(hs->ssi) {
1566 if((hs->left == 0) && (fs_bytes_left(hs->handle) <= 0)) {
1577 #if LWIP_HTTPD_SUPPORT_EXTSTATUS
1582 * @return ERR_OK if file was found and hs has been initialized correctly
1591 if (error_nr == 501) {
1602 if (err != ERR_OK) {
1604 if (err != ERR_OK) {
1606 if (err != ERR_OK) {
1621 * Tries some file names and returns NULL if none found.
1633 if (err != ERR_OK) {
1637 if (err != ERR_OK) {
1641 if (err != ERR_OK) {
1654 #if LWIP_HTTPD_SUPPORT_POST
1658 #if LWIP_HTTPD_POST_MANUAL_WND
1661 if (hs->post_finished) {
1679 * @return ERR_OK if passed successfully, another err_t if the response file
1687 if (p != NULL) {
1689 if (hs->post_content_len_left < p->tot_len) {
1695 #if LWIP_HTTPD_SUPPORT_POST && LWIP_HTTPD_POST_MANUAL_WND
1696 /* prevent connection being closed if httpd_post_data_recved() is called nested */
1700 #if LWIP_HTTPD_SUPPORT_POST && LWIP_HTTPD_POST_MANUAL_WND
1703 if (err != ERR_OK) {
1707 if (hs->post_content_len_left == 0) {
1708 #if LWIP_HTTPD_SUPPORT_POST && LWIP_HTTPD_POST_MANUAL_WND
1709 if (hs->unrecved_bytes != 0) {
1742 if (crlfcrlf != NULL) {
1748 if (scontent_len != NULL) {
1750 if (scontent_len_end != NULL) {
1754 if (content_len == 0) {
1755 /* if atoi returns 0 on error, fix this */
1756 if ((content_len_num[0] != '0') || (content_len_num[1] != '\r')) {
1760 if (content_len >= 0) {
1771 if (err == ERR_OK) {
1775 #if LWIP_HTTPD_POST_MANUAL_WND
1786 if (q != NULL) {
1789 #if LWIP_HTTPD_POST_MANUAL_WND
1790 if (!post_auto_wnd) {
1797 } else if (hs->post_content_len_left == 0) {
1814 /* If we come here, headers are fully received (double-crlf), but Content-Length
1820 /* if we come here, the POST is incomplete */
1821 #if LWIP_HTTPD_SUPPORT_REQUESTLIST
1828 #if LWIP_HTTPD_POST_MANUAL_WND
1840 if (hs != NULL) {
1841 if (hs->no_auto_wnd) {
1843 if (hs->unrecved_bytes >= recved_len) {
1850 if (hs->pcb != NULL) {
1851 if (len != 0) {
1854 if ((hs->post_content_len_left == 0) && (hs->unrecved_bytes == 0)) {
1867 #if LWIP_HTTPD_FS_ASYNC_READ
1868 /** Try to send more data if file has been blocked before
1875 if (hs && (hs->pcb) && (hs->handle)) {
1878 if (http_send(hs->pcb, hs)) {
1879 /* If we wrote anything to be sent, go ahead and send it now. */
1894 * @return ERR_OK if request was OK and hs has been initialized correctly
1895 * ERR_INPROGRESS if request was OK so far but not fully received
1905 #if LWIP_HTTPD_SUPPORT_REQUESTLIST
1908 #if LWIP_HTTPD_SUPPORT_POST
1916 if ((hs->handle != NULL) || (hs->file != NULL)) {
1923 #if LWIP_HTTPD_SUPPORT_REQUESTLIST
1930 if (hs->req == NULL) {
1941 if (hs->req->next != NULL) {
1950 if (p->len != p->tot_len) {
1956 if (data_len >= MIN_REQ_LEN) {
1959 if (crlf != NULL) {
1960 #if LWIP_HTTPD_SUPPORT_POST
1968 if (!strncmp(data, "GET ", 4)) {
1972 #if LWIP_HTTPD_SUPPORT_POST
1973 } else if (!strncmp(data, "POST ", 5)) {
1988 /* if we come here, method is OK, parse URI */
1991 #if LWIP_HTTPD_SUPPORT_V09
1992 if (sp2 == NULL) {
1996 #if LWIP_HTTPD_SUPPORT_POST
1997 if (is_post) {
2005 if ((sp2 != 0) && (sp2 > sp1)) {
2007 if (lwip_strnstr(data, CRLF CRLF, data_len) != NULL) {
2009 #if LWIP_HTTPD_SUPPORT_11_KEEPALIVE
2012 if (!is_09 && (lwip_strnstr(data, HTTP11_CONNECTIONKEEPALIVE, data_len) ||
2024 #if LWIP_HTTPD_SUPPORT_POST
2025 if (is_post) {
2026 #if LWIP_HTTPD_SUPPORT_REQUESTLIST
2032 if (err != ERR_OK) {
2038 if (err == ERR_ARG) {
2054 #if LWIP_HTTPD_SUPPORT_REQUESTLIST
2056 if ((hs->req->tot_len <= LWIP_HTTPD_REQ_BUFSIZE) &&
2063 #if LWIP_HTTPD_SUPPORT_POST
2072 /** Try to find the file specified by uri and, if found, initialize hs
2077 * @param is_09 1 if the request is HTTP/0.9 (no HTTP headers in response)
2078 * @return ERR_OK if file was found and hs has been initialized correctly
2088 #if LWIP_HTTPD_CGI
2091 #if !LWIP_HTTPD_SSI
2098 #if LWIP_HTTPD_MAX_REQUEST_URI_LEN
2100 if ((uri_len > 0) && (uri[uri_len-1] == '/') &&
2103 if (copy_len > 0) {
2108 if ((uri[0] == '/') && (uri[1] == 0)) {
2114 #if LWIP_HTTPD_MAX_REQUEST_URI_LEN
2115 if (copy_len > 0) {
2117 if (len_left > 0) {
2130 if(err == ERR_OK) {
2134 #if LWIP_HTTPD_SSI
2141 if (file == NULL) {
2145 if (params != NULL) {
2151 #if LWIP_HTTPD_CGI
2154 if (g_iNumCGIs && g_pCGIs) {
2156 if (strcmp(uri, g_pCGIs[i].pcCGIName) == 0) {
2173 if (err == ERR_OK) {
2178 #if LWIP_HTTPD_SSI
2179 if (file != NULL) {
2180 /* See if we have been asked for an shtml file and, if so,
2184 if (param != NULL) {
2197 if (!lwip_stricmp(ext, g_pcSSIExtensions[loop])) {
2202 if (param != NULL) {
2208 if (file == NULL) {
2215 /** Initialize a http connection with a file to send (if found).
2219 * @param file file structure to send (or NULL if not found)
2220 * @param is_09 1 if the request is HTTP/0.9 (no HTTP headers in response)
2223 * @param params != NULL if URI has parameters (separated by '?')
2224 * @return ERR_OK if file was found and hs has been initialized correctly
2231 if (file != NULL) {
2233 #if LWIP_HTTPD_SSI
2234 if (tag_check) {
2236 if (ssi != NULL) {
2251 #if LWIP_HTTPD_CUSTOM_FILES
2252 if (file->is_custom_file && (file->data == NULL)) {
2261 #if LWIP_HTTPD_TIMING
2264 #if !LWIP_HTTPD_DYNAMIC_HEADERS
2268 #if LWIP_HTTPD_SUPPORT_V09
2269 if (is_09 && ((hs->handle->flags & FS_FILE_FLAGS_HEADER_INCLUDED) != 0)) {
2273 if (file_start != NULL) {
2280 #if LWIP_HTTPD_CGI_SSI
2281 if (params != NULL) {
2284 #if LWIP_HTTPD_CGI
2285 if (http_cgi_paramcount >= 0) {
2293 #if defined(LWIP_HTTPD_FILE_STATE) && LWIP_HTTPD_FILE_STATE
2307 #if LWIP_HTTPD_DYNAMIC_HEADERS
2310 if ((hs->handle == NULL) || ((hs->handle->flags & FS_FILE_FLAGS_HEADER_INCLUDED) == 0)) {
2316 #if LWIP_HTTPD_SUPPORT_11_KEEPALIVE
2317 if (hs->keepalive) {
2318 #if LWIP_HTTPD_SSI
2319 if (hs->ssi != NULL) {
2324 if ((hs->handle != NULL) &&
2336 * The argument might still be valid (if != NULL).
2346 if (hs != NULL) {
2364 if (hs == NULL) {
2377 * If there has been no data sent (which resets the retries) in 8 seconds, close.
2378 * If the last portion of a file has not been sent in 2 seconds, close.
2389 if (hs == NULL) {
2395 #if LWIP_HTTPD_ABORT_ON_CLOSE_MEM_ERROR
2396 if (closed == ERR_MEM) {
2404 if (hs->retries == HTTPD_MAX_RETRIES) {
2410 /* If this connection has a file open, try to send some more data. If
2413 if(hs && (hs->handle)) {
2415 if(http_send(pcb, hs)) {
2416 /* If we wrote anything to be sent, go ahead and send it now. */
2428 * For HTTP 1.0, this should normally only happen once (if the request fits in one packet).
2437 if ((err != ERR_OK) || (p == NULL) || (hs == NULL)) {
2439 if (p != NULL) {
2444 if (hs == NULL) {
2452 #if LWIP_HTTPD_SUPPORT_POST && LWIP_HTTPD_POST_MANUAL_WND
2453 if (hs->no_auto_wnd) {
2462 #if LWIP_HTTPD_SUPPORT_POST
2463 if (hs->post_content_len_left > 0) {
2469 if (hs->post_content_len_left == 0) {
2477 if (hs->handle == NULL) {
2481 #if LWIP_HTTPD_SUPPORT_REQUESTLIST
2482 if (parsed != ERR_INPROGRESS) {
2484 if (hs->req != NULL) {
2491 if (parsed == ERR_OK) {
2492 #if LWIP_HTTPD_SUPPORT_POST
2493 if (hs->post_content_len_left == 0)
2499 } else if (parsed == ERR_ARG) {
2523 if ((err != ERR_OK) || (pcb == NULL)) {
2533 if (hs == NULL) {
2562 #if HTTPD_USE_MEM_POOL
2564 #if LWIP_HTTPD_SSI
2582 #if LWIP_HTTPD_SSI
2598 #if LWIP_HTTPD_SSI_RAW
2611 #if LWIP_HTTPD_CGI