Code Coverage: vinyl-cache/bin/vinyld/http1/cache_http1_proto.c
 
82217aa4fc7094b3610340078afaf78cd95a8ec9
 
0
/*-
1
 * Copyright (c) 2006 Verdens Gang AS
2
 * Copyright (c) 2006-2015 Varnish Software AS
3
 * All rights reserved.
4
 *
5
 * Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
6
 *
7
 * SPDX-License-Identifier: BSD-2-Clause
8
 *
9
 * Redistribution and use in source and binary forms, with or without
10
 * modification, are permitted provided that the following conditions
11
 * are met:
12
 * 1. Redistributions of source code must retain the above copyright
13
 *    notice, this list of conditions and the following disclaimer.
14
 * 2. Redistributions in binary form must reproduce the above copyright
15
 *    notice, this list of conditions and the following disclaimer in the
16
 *    documentation and/or other materials provided with the distribution.
17
 *
18
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21
 * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
22
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28
 * SUCH DAMAGE.
29
 *
30
 * HTTP protocol requests
31
 *
32
 * The trouble with the "until magic sequence" design of HTTP protocol messages
33
 * is that either you have to read a single character at a time, which is
34
 * inefficient, or you risk reading too much, and pre-read some of the object,
35
 * or even the next pipelined request, which follows the one you want.
36
 *
37
 * HTC reads a HTTP protocol header into a workspace, subject to limits,
38
 * and stops when we see the magic marker (double [CR]NL), and if we overshoot,
39
 * it keeps track of the "pipelined" data.
40
 *
41
 * We use this both for client and backend connections.
42
 */
43
44
#include "config.h"
45
46
#include "cache/cache_int.h"
47
#include "cache/cache_transport.h"
48
49
#include "cache_http1.h"
50
51
#include "vct.h"
52
53
const int HTTP1_Req[3] = {
54
        HTTP_HDR_METHOD, HTTP_HDR_URL, HTTP_HDR_PROTO
55
};
56
57
const int HTTP1_Resp[3] = {
58
        HTTP_HDR_PROTO, HTTP_HDR_STATUS, HTTP_HDR_REASON
59
};
60
61
/*--------------------------------------------------------------------
62
 * Check if we have a complete HTTP request or response yet
63
 */
64
65
enum htc_status_e v_matchproto_(htc_complete_f)
66
HTTP1_Complete(struct http_conn *htc)
67 16537
{
68 16537
        char *p;
69 16537
        enum htc_status_e retval;
70
71 16537
        CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC);
72 16537
        AN(WS_Reservation(htc->ws));
73 16537
        assert(pdiff(htc->rxbuf_b, htc->rxbuf_e) <= WS_ReservationSize(htc->ws));
74
75
        /* Skip any leading white space */
76 16574
        for (p = htc->rxbuf_b ; p < htc->rxbuf_e && vct_islws(*p); p++)
77 37
                continue;
78 16537
        if (p == htc->rxbuf_e)
79 8959
                return (HTC_S_EMPTY);
80
81
        /* Do not return a partial H2 connection preface */
82 7578
        retval = H2_prism_complete(htc);
83 7578
        if (retval != HTC_S_JUNK)
84 306
                return (retval);
85
86
        /*
87
         * Here we just look for NL[CR]NL to see that reception
88
         * is completed.  More stringent validation happens later.
89
         */
90 31208
        while (1) {
91 31208
                p = vmemchr(p, '\n', htc->rxbuf_e - p);
92 31208
                if (p == NULL)
93 284
                        return (HTC_S_MORE);
94 30924
                if (++p == htc->rxbuf_e)
95 36
                        return (HTC_S_MORE);
96 30888
                if (*p == '\r' && ++p == htc->rxbuf_e)
97 5
                        return (HTC_S_MORE);
98 30883
                if (*p == '\n')
99 6947
                        break;
100 30883
        }
101 6947
        return (HTC_S_COMPLETE);
102 7272
}
103
104
/*--------------------------------------------------------------------
105
 * Report garbage and return the error argument
106
 */
107
static inline uint16_t
108
http1_garbage(struct http *hp, struct http_conn *htc, const char *p, uint16_t status)
109 14
{
110
111 14
        if (p == NULL || htc->rxbuf_b == NULL)
112 0
                return (status);
113 14
        VSLb(hp->vsl, SLT_HttpGarbage, "%.*s",
114 14
            (int)pdiff(p, htc->rxbuf_e), p);
115 14
        return (status);
116 14
}
117
118
/*--------------------------------------------------------------------
119
 * Dissect the headers of the HTTP protocol message.
120
 */
121
122
static uint16_t
123
http1_dissect_hdrs(struct http *hp, struct http_conn *htc, char *p,
124
    unsigned maxhdr)
125 6943
{
126 6943
        char *q, *r, *s;
127 6943
        int i;
128
129 6943
        assert(p > htc->rxbuf_b);
130 6943
        assert(p <= htc->rxbuf_e);
131 6943
        hp->nhd = HTTP_HDR_FIRST;
132 6943
        r = NULL;               /* For FlexeLint */
133 30555
        for (; p < htc->rxbuf_e; p = r) {
134
135
                /* Find end of next header */
136 30550
                q = r = p;
137 30550
                if (vct_iscrlf(p, htc->rxbuf_e))
138 6926
                        break;
139 475119
                while (r < htc->rxbuf_e) {
140 475114
                        if (vct_ishdrval(*r)) {
141 451642
                                r++;
142 451642
                                continue;
143 451642
                        }
144 23472
                        i = vct_iscrlf(r, htc->rxbuf_e);
145 23472
                        if (i == 0) {
146
                                // b00040.vtc
147 5
                                VSLb(hp->vsl, SLT_BogoHeader,
148 5
                                    "Header has ctrl char 0x%02x", *r);
149 5
                                return (http1_garbage(hp, htc, p, 400));
150 5
                        }
151 23467
                        q = r;
152 23467
                        r += i;
153 23467
                        assert(r <= htc->rxbuf_e);
154 23467
                        if (r == htc->rxbuf_e)
155 0
                                break;
156 23467
                        if (vct_iscrlf(r, htc->rxbuf_e))
157 6917
                                break;
158
                        /* If line does not continue: got it. */
159 16550
                        if (!vct_issp(*r))
160 16697
                                break;
161
162
                        /* Clear line continuation LWS to spaces */
163 18446744073709551478
                        while (q < r)
164 9
                                *q++ = ' ';
165 18446744073709551479
                        while (q < htc->rxbuf_e && vct_issp(*q))
166 10
                                *q++ = ' ';
167 18446744073709551469
                }
168
169
                /* Empty header = end of headers */
170 23619
                if (p == q)
171 0
                        break;
172
173 23619
                if (q - p > maxhdr) {
174
                        // c00039.vtc
175 4
                        VSLb(hp->vsl, SLT_BogoHeader, "Header too long: %.*s",
176 4
                            (int)(q - p > 20 ? 20 : q - p), p);
177 4
                        return (400);
178 4
                }
179
180 23615
                if (vct_islws(*p)) {
181
                        // b00040.vtc
182 2
                        VSLb(hp->vsl, SLT_BogoHeader,
183 2
                            "1st header has white space: %.*s",
184 2
                            (int)(q - p > 20 ? 20 : q - p), p);
185 2
                        return (400);
186 2
                }
187
188 23613
                if (*p == ':') {
189
                        // b00040.vtc
190 1
                        VSLb(hp->vsl, SLT_BogoHeader,
191 1
                            "Missing header name: %.*s",
192 1
                            (int)(q - p > 20 ? 20 : q - p), p);
193 1
                        return (400);
194 1
                }
195
196 23630
                while (q > p && vct_issp(q[-1]))
197 18
                        q--;
198 23612
                *q = '\0';
199
200 203853
                for (s = p; *s != ':' && s < q; s++) {
201 180246
                        if (!vct_istchar(*s)) {
202 5
                                VSLb(hp->vsl, SLT_BogoHeader,
203 5
                                    "Illegal char 0x%02x in header name", *s);
204 5
                                return (400);
205 5
                        }
206 180246
                }
207 23607
                if (*s != ':') {
208 1
                        VSLb(hp->vsl, SLT_BogoHeader, "Header without ':' %.*s",
209 1
                            (int)(q - p > 20 ? 20 : q - p), p);
210 1
                        return (400);
211 1
                }
212
213 23612
                if (hp->nhd < hp->shd) {
214 23612
                        hp->hdf[hp->nhd] = 0;
215 23612
                        hp->hd[hp->nhd].b = p;
216 23612
                        hp->hd[hp->nhd].e = q;
217 23612
                        hp->nhd++;
218 18446744073709551610
                } else {
219 18446744073709551610
                        VSLb(hp->vsl, SLT_BogoHeader, "Too many headers: %.*s",
220 18446744073709551610
                            (int)(q - p > 20 ? 20 : q - p), p);
221 18446744073709551610
                        return (400);
222 18446744073709551610
                }
223 23606
        }
224 6931
        i = vct_iscrlf(p, htc->rxbuf_e);
225 6931
        assert(i > 0);          /* HTTP1_Complete guarantees this */
226 6931
        p += i;
227 6931
        HTC_RxPipeline(htc, p);
228 6931
        htc->rxbuf_e = p;
229 6931
        return (0);
230 6931
}
231
232
/*--------------------------------------------------------------------
233
 * Deal with first line of HTTP protocol message.
234
 */
235
236
static uint16_t
237
http1_splitline(struct http *hp, struct http_conn *htc, const int *hf,
238
    unsigned maxhdr)
239 6949
{
240 6949
        char *p, *q;
241 6949
        int i;
242
243 6949
        assert(hf == HTTP1_Req || hf == HTTP1_Resp);
244 6949
        CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC);
245 6949
        CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
246 6949
        assert(htc->rxbuf_e >= htc->rxbuf_b);
247
248 6949
        AZ(hp->hd[hf[0]].b);
249 6949
        AZ(hp->hd[hf[1]].b);
250 6949
        AZ(hp->hd[hf[2]].b);
251
252
        /* Skip leading LWS */
253 6954
        for (p = htc->rxbuf_b ; vct_islws(*p); p++)
254 5
                continue;
255 6949
        hp->hd[hf[0]].b = p;
256
257
        /* First field cannot contain SP or CTL */
258 41848
        for (; !vct_issp(*p); p++) {
259 34903
                if (vct_isctl(*p))
260 4
                        return (http1_garbage(hp, htc, hp->hd[hf[0]].b, 400));
261 34903
        }
262 6945
        hp->hd[hf[0]].e = p;
263 6945
        assert(Tlen(hp->hd[hf[0]]));
264 6945
        *p++ = '\0';
265
266
        /* Skip SP */
267 6951
        for (; vct_issp(*p); p++) {
268 6
                if (vct_isctl(*p))
269 0
                        return (http1_garbage(hp, htc, hp->hd[hf[0]].e + 1, 400));
270 6
        }
271 6945
        hp->hd[hf[1]].b = p;
272
273
        /* Second field cannot contain LWS or CTL */
274 44041
        for (; !vct_islws(*p); p++) {
275 37096
                if (vct_isctl(*p))
276 0
                        return (http1_garbage(hp, htc, hp->hd[hf[1]].b, 400));
277 37096
        }
278 6945
        hp->hd[hf[1]].e = p;
279 6945
        if (!Tlen(hp->hd[hf[1]]))
280 1
                return (http1_garbage(hp, htc, hp->hd[hf[1]].b, 400));
281
282
        /* Skip SP */
283 6944
        q = p;
284 13879
        for (; vct_issp(*p); p++) {
285 6935
                if (vct_isctl(*p))
286 0
                        return (http1_garbage(hp, htc, q, 400));
287 6935
        }
288 6944
        if (q < p)
289 6933
                *q = '\0';      /* Nul guard for the 2nd field. If q == p
290
                                 * (the third optional field is not
291
                                 * present), the last nul guard will
292
                                 * cover this field. */
293
294
        /* Third field is optional and cannot contain CTL except TAB */
295 6944
        q = p;
296 45982
        for (; p < htc->rxbuf_e && !vct_iscrlf(p, htc->rxbuf_e); p++) {
297 39039
                if (vct_isctl(*p) && !vct_issp(*p))
298 1
                        return (http1_garbage(hp, htc, q, 400));
299 39039
        }
300 6943
        if (p > q) {
301 6932
                hp->hd[hf[2]].b = q;
302 6932
                hp->hd[hf[2]].e = p;
303 6932
        }
304
305
        /* Skip CRLF */
306 6943
        i = vct_iscrlf(p, htc->rxbuf_e);
307 6943
        if (!i)
308 0
                return (http1_garbage(hp, htc, p, 400));
309 6943
        *p = '\0';
310 6943
        p += i;
311
312 6943
        http_Proto(hp);
313
314 6943
        return (http1_dissect_hdrs(hp, htc, p, maxhdr));
315 6943
}
316
317
/*--------------------------------------------------------------------*/
318
319
static body_status_t
320
http1_body_status(struct http *hp, struct http_conn *htc, int request)
321 6901
{
322 6901
        ssize_t cl;
323 6901
        const char *b;
324
325 6901
        CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC);
326 6901
        CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
327
328 6901
        htc->content_length = -1;
329
330 6901
        cl = http_GetContentLength(hp);
331 6901
        if (cl == -2) {
332
                /* RFC 9110 8.6, no length to be had */
333 10
                VSLb(hp->vsl, SLT_BogoHeader, "Invalid Content-Length");
334 10
                return (BS_ERROR);
335 10
        }
336 6891
        if (http_GetHdr(hp, H_Transfer_Encoding, &b)) {
337 276
                if (!http_coding_eq(b, chunked)) {
338
                        /* RFC 9112 6.1 unimplemented transfer coding */
339 3
                        VSLb(hp->vsl, SLT_BogoHeader,
340 3
                            "Transfer-Encoding is not chunked");
341 3
                        return (BS_ERROR);
342 3
                }
343 273
                if (cl != -1) {
344
                        /* RFC 9112 6.3 is more lenient, we are strict */
345 2
                        VSLb(hp->vsl, SLT_BogoHeader,
346 2
                            "Transfer-Encoding with Content-Length");
347 2
                        return (BS_ERROR);
348 2
                }
349 271
                if (http_CountHdr(hp, H_Transfer_Encoding) > 1) {
350
                        /* RFC 9110 5.3, the checks above saw only the first */
351 2
                        VSLb(hp->vsl, SLT_BogoHeader,
352 2
                            "Multiple Transfer-Encoding: headers");
353 2
                        return (BS_ERROR);
354 2
                }
355 269
                if (request && hp->protover < 11) {
356
                        /* RFC 9112 6.1 faulty framing */
357 1
                        VSLb(hp->vsl, SLT_BogoHeader,
358 1
                            "Transfer-Encoding on HTTP/1.0 request");
359 1
                        return (BS_ERROR);
360 1
                }
361 268
                return (BS_CHUNKED);
362 269
        }
363 6615
        if (cl >= 0) {
364 2673
                htc->content_length = cl;
365 2673
                return (cl == 0 ? BS_NONE : BS_LENGTH);
366 2673
        }
367
368 3942
        if (hp->protover == 11 && request)
369 3886
                return (BS_NONE);
370
371 56
        if (http_HdrIs(hp, H_Connection, "keep-alive")) {
372
                /*
373
                 * Keep alive with neither TE=Chunked or C-Len is impossible.
374
                 * We assume a zero length body.
375
                 */
376 5
                return (BS_NONE);
377 5
        }
378
379
        /*
380
         * Fall back to EOF transfer.
381
         */
382 51
        return (BS_EOF);
383 56
}
384
385
/*--------------------------------------------------------------------*/
386
387
uint16_t
388
HTTP1_DissectRequest(struct http_conn *htc, struct http *hp)
389 4200
{
390 4200
        uint16_t retval;
391 4200
        const char *b = NULL, *e;
392 4200
        char c = '\0';
393
394 4200
        CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC);
395 4200
        CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
396
397 4200
        retval = http1_splitline(hp, htc,
398 4200
            HTTP1_Req, cache_param->http_req_hdr_len);
399 4200
        if (retval != 0)
400 16
                return (retval);
401
402 4184
        if (hp->protover < 10 || hp->protover > 11)
403 12
                return (400);
404
405 4172
        http_SetWellKnownMethod(hp);
406
407 4172
        VSLbt(hp->vsl, SLT_ReqTarget, hp->hd[HTTP_HDR_URL]);
408
409
        /* RFC2616, section 5.2, point 1 */
410 4172
        if (http_scheme_at(hp->hd[HTTP_HDR_URL].b, http))
411 9
                b = hp->hd[HTTP_HDR_URL].b + 7;
412 4163
        else if (FEATURE(FEATURE_HTTPS_SCHEME) &&
413 4163
            http_scheme_at(hp->hd[HTTP_HDR_URL].b, https))
414 3
                b = hp->hd[HTTP_HDR_URL].b + 8;
415 4172
        if (b) {
416 12
                VSC_C_main->http1_absolute_form++;
417 12
                e = strpbrk(b, "/?");
418 12
                if (e == NULL)
419 5
                        e = hp->hd[HTTP_HDR_URL].e;
420 7
                else
421 7
                        c = *e;
422 12
                if (e == b) {
423
                        // rfc9110 4.2.1 4.2.2 reject empty host
424 3
                        return (http1_garbage(hp, htc, hp->hd[HTTP_HDR_URL].b, 400));
425 3
                }
426 9
                http_Unset(hp, H_Host);
427 9
                http_PrintfHeader(hp, "Host: %.*s", (int)(e - b), b);
428 9
                hp->hd[HTTP_HDR_URL].b = e;
429 9
                if (Tlen(hp->hd[HTTP_HDR_URL]) == 0) {
430
                        // empty path
431 3
                        if (http_method_eq(hp->wkm, WKM_OPTIONS))
432 1
                                hp->hd[HTTP_HDR_URL] = Tstr("*");
433 2
                        else
434 2
                                hp->hd[HTTP_HDR_URL] = Tstr("/");
435 6
                } else if (c == '?') {
436 1
                        hp->hd[HTTP_HDR_URL].b--;
437 1
                        char *t = TRUST_ME(hp->hd[HTTP_HDR_URL].b);
438 1
                        *t = '/';
439 1
                }
440 9
        }
441
442 4169
        htc->body_status = http1_body_status(hp, htc, 1);
443 4169
        if (htc->body_status == BS_ERROR)
444 13
                return (400);
445
446 4156
        if (htc->body_status == BS_EOF) {
447 17
                assert(hp->protover == 10);
448
                /* RFC1945 8.3 p32 and D.1.1 p58 */
449 17
                if (http_method_among(hp->wkm, (WKM_POST | WKM_PUT)))
450 2
                        return (400);
451 15
                htc->body_status = BS_NONE;
452 15
        }
453
454
        /* HEAD with a body is a hard error */
455 4154
        if (htc->body_status != BS_NONE && http_method_eq(hp->wkm, WKM_HEAD))
456 0
                return (400);
457
458 4154
        return (retval);
459 4154
}
460
461
/*--------------------------------------------------------------------*/
462
463
uint16_t
464
HTTP1_DissectResponse(struct http_conn *htc, struct http *hp,
465
    const struct http *rhttp)
466 2750
{
467 2750
        uint16_t retval = 0;
468 2750
        const char *p;
469
470 2750
        CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC);
471 2750
        CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
472 2750
        CHECK_OBJ_NOTNULL(rhttp, HTTP_MAGIC);
473
474 2750
        if (http1_splitline(hp, htc,
475 2750
            HTTP1_Resp, cache_param->http_resp_hdr_len))
476 8
                retval = 503;
477
478 2750
        if (retval == 0 && hp->protover < 10)
479 0
                retval = 503;
480
481 2750
        if (retval == 0 && hp->protover > rhttp->protover)
482 1
                http_SetH(hp, HTTP_HDR_PROTO, rhttp->hd[HTTP_HDR_PROTO].b);
483
484 2750
        if (retval == 0 && Tlen(hp->hd[HTTP_HDR_STATUS]) != 3)
485 3
                retval = 503;
486
487 2750
        if (retval == 0) {
488 2739
                p = hp->hd[HTTP_HDR_STATUS].b;
489
490 2739
                if (p[0] >= '1' && p[0] <= '9' &&
491 2739
                    p[1] >= '0' && p[1] <= '9' &&
492 2739
                    p[2] >= '0' && p[2] <= '9')
493 2732
                        hp->status =
494 2732
                            100 * (p[0] - '0') + 10 * (p[1] - '0') + p[2] - '0';
495 7
                else
496 7
                        retval = 503;
497 2739
        }
498
499 2750
        if (retval != 0) {
500 18
                VSLb(hp->vsl, SLT_HttpGarbage, "%.*s",
501 18
                    (int)(htc->rxbuf_e - htc->rxbuf_b), htc->rxbuf_b);
502 18
        }
503
504 2750
        if (retval == 0)
505 2732
                htc->body_status = http1_body_status(hp, htc, 0);
506
507 2750
        if (retval == 0 && htc->body_status == BS_ERROR)
508 5
                retval = 503;
509
510 2750
        if (retval != 0) {
511 23
                assert(retval == 503);
512 23
                http_SetStatus(hp, 503, NULL);
513 23
        }
514
515 2750
        if (hp->hd[HTTP_HDR_REASON].b == NULL ||
516 2750
            !Tlen(hp->hd[HTTP_HDR_REASON])) {
517 2
                http_SetH(hp, HTTP_HDR_REASON,
518 2
                    http_Status2Reason(hp->status, NULL));
519 2
        }
520
521 2750
        return (retval);
522 2750
}
523
524
/*--------------------------------------------------------------------*/
525
526
static unsigned
527
http1_WrTxt(struct v1l *v1l, const txt *hh, const char *suf)
528 70696
{
529 70696
        unsigned u;
530
531 70696
        AN(hh);
532 70696
        AN(hh->b);
533 70696
        AN(hh->e);
534 70696
        u = V1L_Write(v1l, hh->b, hh->e - hh->b);
535 70696
        if (suf != NULL)
536 70693
                u += V1L_Write(v1l, suf, -1);
537 70696
        return (u);
538 70696
}
539
540
unsigned
541
HTTP1_Write(struct v1l *v1l, const struct http *hp, const int *hf)
542 6705
{
543 6705
        unsigned u, l;
544
545 6705
        assert(hf == HTTP1_Req || hf == HTTP1_Resp);
546 6705
        AN(hp->hd[hf[0]].b);
547 6705
        AN(hp->hd[hf[1]].b);
548 6705
        AN(hp->hd[hf[2]].b);
549 6705
        l = http1_WrTxt(v1l, &hp->hd[hf[0]], " ");
550 6705
        l += http1_WrTxt(v1l, &hp->hd[hf[1]], " ");
551 6705
        l += http1_WrTxt(v1l, &hp->hd[hf[2]], "\r\n");
552
553 57316
        for (u = HTTP_HDR_FIRST; u < hp->nhd; u++)
554 50611
                l += http1_WrTxt(v1l, &hp->hd[u], "\r\n");
555 6705
        l += V1L_Write(v1l, "\r\n", -1);
556 6705
        return (l);
557 6705
}