Lines Matching +full:path +full:- +full:is +full:- +full:absolute
10 * This software is licensed as described in the file COPYING, which
15 * copies of the Software, and permit persons to whom the Software is
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * SPDX-License-Identifier: curl
33 #include "urlapi-int.h"
46 parser->max_line_len = max_line_len; in Curl_h1_req_parse_init()
47 Curl_dyn_init(&parser->scratch, max_line_len); in Curl_h1_req_parse_init()
53 Curl_http_req_free(parser->req); in Curl_h1_req_parse_free()
54 Curl_dyn_free(&parser->scratch); in Curl_h1_req_parse_free()
55 parser->req = NULL; in Curl_h1_req_parse_free()
56 parser->done = FALSE; in Curl_h1_req_parse_free()
62 DEBUGASSERT(parser->line); in trim_line()
63 if(parser->line_len) { in trim_line()
64 if(parser->line[parser->line_len - 1] == '\n') in trim_line()
65 --parser->line_len; in trim_line()
66 if(parser->line_len) { in trim_line()
67 if(parser->line[parser->line_len - 1] == '\r') in trim_line()
68 --parser->line_len; in trim_line()
78 if(parser->line_len > parser->max_line_len) { in trim_line()
90 DEBUGASSERT(!parser->line); in detect_line()
94 return -1; in detect_line()
96 parser->line = buf; in detect_line()
97 parser->line_len = line_end - buf + 1; in detect_line()
99 return (ssize_t)parser->line_len; in detect_line()
108 if(parser->line) { in next_line()
109 parser->line = NULL; in next_line()
110 parser->line_len = 0; in next_line()
111 Curl_dyn_reset(&parser->scratch); in next_line()
116 if(Curl_dyn_len(&parser->scratch)) { in next_line()
118 *err = Curl_dyn_addn(&parser->scratch, parser->line, parser->line_len); in next_line()
120 return -1; in next_line()
121 parser->line = Curl_dyn_ptr(&parser->scratch); in next_line()
122 parser->line_len = Curl_dyn_len(&parser->scratch); in next_line()
126 return -1; in next_line()
130 *err = Curl_dyn_addn(&parser->scratch, (const unsigned char *)buf, buflen); in next_line()
131 nread = (*err)? -1 : (ssize_t)buflen; in next_line()
139 const char *p, *m, *target, *hv, *scheme, *authority, *path; in start_req() local
145 DEBUGASSERT(!parser->req); in start_req()
147 p = memchr(parser->line, ' ', parser->line_len); in start_req()
148 if(!p || p == parser->line) in start_req()
151 m = parser->line; in start_req()
152 m_len = p - parser->line; in start_req()
158 for(i = parser->line_len; i > m_len; --i) { in start_req()
159 if(parser->line[i] == ' ') { in start_req()
160 hv = &parser->line[i + 1]; in start_req()
161 hv_len = parser->line_len - i; in start_req()
162 target_len = (hv - target) - 1; in start_req()
171 + do that when STRICT option is supplied. */ in start_req()
175 * origin-form: path + optional query in start_req()
176 * absolute-form: absolute URI in start_req()
177 * authority-form: host+port for CONNECT in start_req()
178 * asterisk-form: '*' for OPTIONS in start_req()
180 * from TARGET, we derive `scheme` `authority` `path` in start_req()
181 * origin-form -- -- TARGET in start_req()
182 * absolute-form URL* URL* URL* in start_req()
183 * authority-form -- TARGET -- in start_req()
184 * asterisk-form -- -- TARGET in start_req()
186 scheme = authority = path = NULL; in start_req()
190 /* asterisk-form */ in start_req()
191 path = target; in start_req()
195 /* authority-form */ in start_req()
200 /* origin-form */ in start_req()
201 path = target; in start_req()
205 /* origin-form OR absolute-form */ in start_req()
209 /* default, unless we see an absolute URL */ in start_req()
210 path = target; in start_req()
213 /* URL parser wants 0-termination */ in start_req()
218 /* See if treating TARGET as an absolute URL makes sense */ in start_req()
239 /* we should have an absolute URL or have seen `/` earlier */ in start_req()
245 result = Curl_http_req_make2(&parser->req, m, m_len, url, scheme_default); in start_req()
252 result = Curl_http_req_make(&parser->req, m, m_len, scheme, scheme_len, in start_req()
253 authority, authority_len, path, path_len); in start_req()
269 while(!parser->done) { in Curl_h1_req_parse_read()
273 nread = -1; in Curl_h1_req_parse_read()
282 buflen -= (size_t)n; in Curl_h1_req_parse_read()
284 if(!parser->line) { in Curl_h1_req_parse_read()
289 else if(!parser->req) { in Curl_h1_req_parse_read()
292 nread = -1; in Curl_h1_req_parse_read()
296 else if(parser->line_len == 0) { in Curl_h1_req_parse_read()
298 if(!parser->req) { in Curl_h1_req_parse_read()
300 nread = -1; in Curl_h1_req_parse_read()
303 parser->done = TRUE; in Curl_h1_req_parse_read()
304 Curl_dyn_reset(&parser->scratch); in Curl_h1_req_parse_read()
308 *err = Curl_dynhds_h1_add_line(&parser->req->headers, in Curl_h1_req_parse_read()
309 parser->line, parser->line_len); in Curl_h1_req_parse_read()
311 nread = -1; in Curl_h1_req_parse_read()
327 req->method, in Curl_h1_req_write_head()
328 req->scheme? req->scheme : "", in Curl_h1_req_write_head()
329 req->scheme? "://" : "", in Curl_h1_req_write_head()
330 req->authority? req->authority : "", in Curl_h1_req_write_head()
331 req->path? req->path : "", in Curl_h1_req_write_head()
336 result = Curl_dynhds_h1_dprint(&req->headers, dbuf); in Curl_h1_req_write_head()