~ubuntu-branches/ubuntu/precise/crossroads/precise

« back to all changes in this revision

Viewing changes to xr/httpbuffer/setversion.cc

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Ritter
  • Date: 2010-07-05 16:27:00 UTC
  • Revision ID: james.westby@ubuntu.com-20100705162700-0g08tfav8ee9y51u
Tags: upstream-2.65
ImportĀ upstreamĀ versionĀ 2.65

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "httpbuffer"
 
2
 
 
3
bool Httpbuffer::setversion (char v) {
 
4
    PROFILE("Httpbuffer::setversion");
 
5
 
 
6
    // No first line? Nothing to do yet.
 
7
    unsigned croff = charfind('\n');
 
8
    if (!croff)
 
9
        return false;
 
10
 
 
11
    // Find the HTTP/1.x header
 
12
    unsigned stroff = strfind("HTTP/1.");
 
13
    if (!stroff || stroff > croff)
 
14
        return false;
 
15
    
 
16
    // Poke in the new version.
 
17
    return setchar(stroff + 7, v);
 
18
}