File: setversion.cc

package info (click to toggle)
crossroads 2.65-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 2,664 kB
  • ctags: 355
  • sloc: cpp: 4,212; perl: 1,658; xml: 269; makefile: 186; sh: 46
file content (18 lines) | stat: -rw-r--r-- 410 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "httpbuffer"

bool Httpbuffer::setversion (char v) {
    PROFILE("Httpbuffer::setversion");

    // No first line? Nothing to do yet.
    unsigned croff = charfind('\n');
    if (!croff)
	return false;

    // Find the HTTP/1.x header
    unsigned stroff = strfind("HTTP/1.");
    if (!stroff || stroff > croff)
	return false;
    
    // Poke in the new version.
    return setchar(stroff + 7, v);
}