Mercurial > hg > nginx
comparison src/http/ngx_http_parse.c @ 23:f540a63026c9
nginx-0.0.1-2002-12-06-19:32:33 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 06 Dec 2002 16:32:33 +0000 |
parents | df7fb216a149 |
children | 77c7629a2627 |
comparison
equal
deleted
inserted
replaced
22:aa3b53e74728 | 23:f540a63026c9 |
---|---|
310 r->state = state; | 310 r->state = state; |
311 return NGX_AGAIN; | 311 return NGX_AGAIN; |
312 } | 312 } |
313 } | 313 } |
314 | 314 |
315 #if 0 | |
316 int ngx_read_http_response_line(ngx_http_request_t *r) | |
317 { | |
318 char c, ch; | |
319 char *p; | |
320 enum { | |
321 sw_start = 0, | |
322 sw_done | |
323 } state; | |
324 | |
325 state = r->state; | |
326 p = r->header_in->pos.mem; | |
327 | |
328 while (p < r->header_in->last.mem && state < sw_done) { | |
329 ch = *p++; | |
330 | |
331 /* | |
332 printf("\nstate: %d, pos: %x, end: %x, char: '%c' buf: %s", | |
333 state, p, r->header_in->last, ch, p); | |
334 */ | |
335 | |
336 switch (state) { | |
337 | |
338 /* "HTTP/" */ | |
339 case sw_start: | |
340 if (p + 3 >= r->header_in->last.mem) | |
341 return NGX_AGAIN; | |
342 | |
343 if (ch != 'H' || *p != 'T' || *(p + 1) != 'T' || *(p + 2) != 'P' | |
344 || *(p + 3) != '/') | |
345 return NGX_HTTP_PARSE_NO_HEADER; | |
346 | |
347 p += 4; | |
348 state = sw_first_major_digit; | |
349 break; | |
350 | |
351 /* first digit of major HTTP version */ | |
352 case sw_first_major_digit: | |
353 if (ch < '1' || ch > '9') | |
354 return NGX_HTTP_PARSE_NO_HEADER; | |
355 | |
356 state = sw_major_digit; | |
357 break; | |
358 | |
359 /* major HTTP version or dot */ | |
360 case sw_major_digit: | |
361 if (ch == '.') { | |
362 state = sw_first_minor_digit; | |
363 break; | |
364 } | |
365 | |
366 if (ch < '0' || ch > '9') | |
367 return NGX_HTTP_PARSE_NO_HEADER; | |
368 | |
369 break; | |
370 | |
371 /* first digit of minor HTTP version */ | |
372 case sw_first_minor_digit: | |
373 if (ch < '0' || ch > '9') | |
374 return NGX_HTTP_PARSE_NO_HEADER; | |
375 | |
376 state = sw_minor_digit; | |
377 break; | |
378 | |
379 /* minor HTTP version or end of request line */ | |
380 case sw_minor_digit: | |
381 if (ch == ' ') { | |
382 state = sw_code; | |
383 break; | |
384 } | |
385 | |
386 if (ch < '0' || ch > '9') | |
387 return NGX_HTTP_PARSE_NO_HEADER; | |
388 | |
389 break; | |
390 } | |
391 } | |
392 } | |
393 #endif | |
394 | |
395 int ngx_read_http_header_line(ngx_http_request_t *r) | 315 int ngx_read_http_header_line(ngx_http_request_t *r) |
396 { | 316 { |
397 char c, ch; | 317 char c, ch; |
398 char *p; | 318 char *p; |
399 enum { | 319 enum { |