Lines Matching refs:http
685 if (wsi->a.vhost->http.error_document_404 &&
686 !strcmp(uri, wsi->a.vhost->http.error_document_404))
700 if (wsi->http.fop_fd)
701 lws_vfs_file_close(&wsi->http.fop_fd);
703 wsi->http.fop_fd = fops->LWS_FOP_OPEN(wsi->a.context->fops,
705 if (!wsi->http.fop_fd) {
719 if (fstat(wsi->http.fop_fd->fd, &st)) {
741 wsi->http.fop_fd->mod_time = (uint32_t)st.st_mtime;
768 (unsigned long long)lws_vfs_get_length(wsi->http.fop_fd),
769 (unsigned long)lws_vfs_get_mod_time(wsi->http.fop_fd));
776 wsi->http.ah->frag_index[WSI_TOKEN_HTTP_RANGE] = 0;
840 lws_vfs_file_close(&wsi->http.fop_fd);
946 hm = wsi->a.vhost->http.mount_list;
1169 fi = wsi->http.ah->frag_index[WSI_TOKEN_HTTP_AUTHORIZATION];
1170 if (wsi->http.ah->frags[fi].nfrag) {
1228 wsi->http.ah->frags[fi].len = (uint16_t)lws_ptr_diff_size_t(pcolon, &plain[0]);
1247 * Set up an onward http proxy connection according to the mount this
1450 i.alpn = "http/1.1";
1488 cwsi->http.proxy_clientside = 1;
1504 "http://", "https://"
1650 wsi->http.rx_content_length = 0;
1651 wsi->http.content_length_explicitly_zero = 0;
1659 wsi->http.rx_content_length = 100 * 1024 * 1024;
1665 wsi->http.rx_content_remain = wsi->http.rx_content_length =
1667 if (!wsi->http.rx_content_length) {
1668 wsi->http.content_length_explicitly_zero = 1;
1674 wsi->http.request_version = HTTP_VERSION_2;
1688 wsi->http.request_version = request_version;
1696 /* Override default if http "Connection:" header: */
1707 wsi->http.conn_type = conn_type;
1727 * We accepted http:// only so we could redirect to
1849 * For the duration of this http transaction, bind us to the
1865 if (lws_bind_protocol(wsi, pp, "http action CALLBACK bind"))
1997 lwsl_debug("wsi->http.rx_content_length %lld %d %d\n",
1998 (long long)wsi->http.rx_content_length,
2001 if (wsi->http.content_length_explicitly_zero &&
2025 if (wsi->http.rx_content_length <= 0)
2033 wsi->http.rx_content_remain = wsi->http.rx_content_length;
2179 wsi->http.ah);
2213 if (!wsi->http.ah) {
2234 * http parser went off the rails and
2238 * We are transitioning from http with an AH, to
2260 if (!wsi->http.ah)
2263 if (wsi->http.ah->parser_state != WSI_PARSING_COMPLETE)
2332 * of upgrade from http... but we may want to redirect him at
2333 * http level. In that case, we need to check the redirect
2334 * situation even though he's not actually wanting http and
2429 wsi->http.fop_fd = NULL;
2437 (void *)wsi->http.ah);
2464 ah = wsi->http.ah;
2468 /* http2 union member has http union struct at start */
2469 wsi->http.ah = ah;
2523 if (wsi->http.cgi_transaction_complete)
2528 || wsi->http.comp_ctx.buflist_comp ||
2529 wsi->http.comp_ctx.may_have_more
2533 * ...so he tried to send something large as the http reply,
2542 wsi->http.deferred_transaction_completed = 1;
2554 if (wsi->http.rx_content_length && wsi->http.rx_content_remain) {
2574 lws_snprintf(tmp, sizeof(tmp), "%u", wsi->http.response_code);
2588 && !wsi->http.cgi
2605 if (wsi->http.cgi) {
2607 wsi->http.cgi_transaction_complete = 1;
2609 lws_spawn_piped_destroy(&wsi->http.cgi->lsp);
2610 lws_sul_cancel(&wsi->http.cgi->sul_grace);
2612 lws_free_set_NULL(wsi->http.cgi);
2613 wsi->http.cgi_transaction_complete = 0;
2624 if (wsi->http.conn_type != HTTP_CONNECTION_KEEP_ALIVE) {
2641 wsi->http.tx_content_length = 0;
2642 wsi->http.tx_content_remain = 0;
2646 wsi->http.access_log.sent = 0;
2650 wsi->http.fop_fd != NULL)
2651 lws_vfs_file_close(&wsi->http.fop_fd);
2671 if (wsi->http.ah) {
2707 if (wsi->http.ah)
2708 wsi->http.ah->ues = URIES_IDLE;
2732 struct lws_range_parsing *rp = &wsi->http.range;
2754 * If wsi->http.fop_fd is already set, the caller already opened it
2756 if (!wsi->http.fop_fd) {
2759 wsi->http.fop_fd = fops->LWS_FOP_OPEN(wsi->a.context->fops,
2761 if (!wsi->http.fop_fd) {
2772 * Caution... wsi->http.fop_fd is live from here
2775 wsi->http.filelen = lws_vfs_get_length(wsi->http.fop_fd);
2776 total_content_length = wsi->http.filelen;
2779 ranges = lws_ranges_init(wsi, rp, wsi->http.filelen);
2796 lws_vfs_file_close(&wsi->http.fop_fd);
2807 if ((wsi->http.fop_fd->flags & (LWS_FOP_FLAG_COMPR_ACCEPTABLE_GZIP |
2846 lws_strncpy(wsi->http.multipart_content_type, content_type,
2847 sizeof(wsi->http.multipart_content_type));
2905 wsi->http.range.inside = 0;
2913 /* for http/1.1 ... */
2916 && !wsi->http.lcs
2920 * http compression translation, then send the naive
2929 if (wsi->http.lcs) {
2931 /* ...otherwise, for http 1 it must go chunked.
2947 * using an http compression translation, the
2954 wsi->http.comp_ctx.chunking = 1;
3003 wsi->http.filepos = 0;
3008 lws_vfs_file_close(&wsi->http.fop_fd);
3020 lws_vfs_file_close(&wsi->http.fop_fd);
3060 if (wsi->http.comp_ctx.buflist_comp ||
3061 wsi->http.comp_ctx.may_have_more) {
3065 __func__, wsi->http.comp_ctx.buflist_comp,
3066 wsi->http.comp_ctx.may_have_more);
3080 if (wsi->http.filepos == wsi->http.filelen)
3087 if (wsi->http.range.count_ranges && !wsi->http.range.inside) {
3090 wsi->http.range.start);
3092 if ((long long)lws_vfs_file_seek_cur(wsi->http.fop_fd,
3093 (lws_fileofs_t)wsi->http.range.start -
3094 (lws_fileofs_t)wsi->http.filepos) < 0)
3097 wsi->http.filepos = wsi->http.range.start;
3099 if (wsi->http.range.count_ranges > 1) {
3108 wsi->http.multipart_content_type,
3109 wsi->http.range.start,
3110 wsi->http.range.end,
3111 wsi->http.range.extent);
3115 wsi->http.range.budget = wsi->http.range.end -
3116 wsi->http.range.start + 1;
3117 wsi->http.range.inside = 1;
3136 if (wsi->http.tx_content_length)
3137 if (poss > wsi->http.tx_content_remain)
3138 poss = wsi->http.tx_content_remain;
3173 if (wsi->http.range.count_ranges) {
3174 if (wsi->http.range.count_ranges > 1)
3176 if (poss > wsi->http.range.budget)
3177 poss = wsi->http.range.budget;
3188 if (lws_vfs_file_read(wsi->http.fop_fd, &amount, p, poss) < 0)
3206 args.final = wsi->http.filepos + (unsigned int)n ==
3207 wsi->http.filelen;
3221 if (wsi->http.range.send_ctr + 1 ==
3222 wsi->http.range.count_ranges && // last range
3223 wsi->http.range.count_ranges > 1 && // was 2+ ranges (ie, multipart)
3224 wsi->http.range.budget - amount == 0) {// final part
3230 m = lws_write(wsi, p, (unsigned int)n, wsi->http.filepos + amount ==
3231 wsi->http.filelen ?
3236 wsi->http.filepos += amount;
3239 if (wsi->http.range.count_ranges >= 1) {
3240 wsi->http.range.budget -= amount;
3241 if (wsi->http.range.budget == 0) {
3243 wsi->http.range.inside = 0;
3244 wsi->http.range.send_ctr++;
3246 if (lws_ranges_next(&wsi->http.range) < 1) {
3256 if (lws_vfs_file_seek_cur(wsi->http.fop_fd,
3266 && !wsi->http.comp_ctx.buflist_comp &&
3267 !wsi->http.comp_ctx.may_have_more
3269 ) && (wsi->http.filepos >= wsi->http.filelen
3278 lws_vfs_file_close(&wsi->http.fop_fd);
3287 * For http/1.x, the choices from
3292 * However for http/2. while we are
3320 lws_vfs_file_close(&wsi->http.fop_fd);