<commit_before>/*
 * Copyright (c) 2007 Digital Bazaar, Inc.  All rights reserved.
 */
#ifndef db_net_http_HttpRequestHeader_H
#define db_net_http_HttpRequestHeader_H

#include "db/net/http/HttpHeader.h"

namespace db
{
namespace net
{
namespace http
{

/**
 * An HttpRequestHeader is the header for an HTTP Request Message. It contains
 * a Request-Line, and, optionally, a collection of HTTP header fields.
 * 
 * Here is an example of a HTTP/1.1 request header, each line is terminated
 * with a CRLF (there is a blank line at the end):
 * 
 * GET /some/path/ HTTP/1.1
 * Host: www.someurl.com
 * Connection: close
 * Accept-Encoding: gzip
 * Accept: image/gif, text/html
 * User-Agent: Mozilla 4.0
 * 
 * 
 * @author <NAME>
 */
class HttpRequestHeader : public HttpHeader
{
protected:
   /**
    * The method (i.e. "GET", "POST") for the request.
    */
   char* mMethod;
   
   /**
    * The path for the request.
    */
   char* mPath;
   
   /**
    * The version (major.minor) for the request.
    */
   char* mVersion;
   
public:
   /**
    * Creates a new HttpRequestHeader.
    */
   HttpRequestHeader();
   
   /**
    * Destructs this HttpRequestHeader.
    */
   virtual ~HttpRequestHeader();
   
   /**
    * Parses the start line for this HttpHeader from the passed string.
    * 
    * @param str the string to parse from.
    * @param length the length of the start line (no null character included).
    * 
    * @return true if the start line could be parsed, false if not.
    */
   virtual bool parseStartLine(const char* str, unsigned int length);
   
   /**
    * Gets the start line for this HttpHeader.
    * 
    * @param line the startLine to populate.
    * 
    * @return true if the start line could be parsed, false if not.
    */
   virtual void getStartLine(std::string& line);
   
   /**
    * Returns true if this header has a special start line, false if not.
    * 
    * @return true if this header has a special start line, false if not.
    */
   virtual bool hasStartLine();
   
   /**
    * Sets the HTTP method for the request.
    * 
    * @param method the method for the request (i.e. "GET", "POST").
    */
   virtual void setMethod(const char* method);
   
   /**
    * Gets the HTTP method for the request.
    * 
    * @return the method for the request (i.e. "GET", "POST").
    */
   virtual const char* getMethod();
   
   /**
    * Sets the HTTP version for the request (major.minor).
    * 
    * @param version the version for the request (i.e. "1.0", "1.1").
    */
   virtual void setVersion(const char* version);
   
   /**
    * Gets the HTTP version for the request (major.minor).
    * 
    * @return the version for the request (i.e. "1.0", "1.1").
    */
   virtual const char* getVersion();
   
   /**
    * Sets the path for the request.
    * 
    * @param path the path for the request.
    */
   virtual void setPath(const char* path);
   
   /**
    * Gets the path for the request.
    * 
    * @return the path for the request.
    */
   virtual const char* getPath();
};

} // end namespace http
} // end namespace net
} // end namespace db
#endif
<commit_msg>Simple doc comment as a reminder the Request-URI can have a query.<commit_after>/*
 * Copyright (c) 2007 Digital Bazaar, Inc.  All rights reserved.
 */
#ifndef db_net_http_HttpRequestHeader_H
#define db_net_http_HttpRequestHeader_H

#include "db/net/http/HttpHeader.h"

namespace db
{
namespace net
{
namespace http
{

/**
 * An HttpRequestHeader is the header for an HTTP Request Message. It contains
 * a Request-Line, and, optionally, a collection of HTTP header fields.
 * 
 * Here is an example of a HTTP/1.1 request header, each line is terminated
 * with a CRLF (there is a blank line at the end):
 * 
 * GET /some/path/?query HTTP/1.1
 * Host: www.someurl.com
 * Connection: close
 * Accept-Encoding: gzip
 * Accept: image/gif, text/html
 * User-Agent: Mozilla 4.0
 * 
 * 
 * @author <NAME>
 */
class HttpRequestHeader : public HttpHeader
{
protected:
   /**
    * The method (i.e. "GET", "POST") for the request.
    */
   char* mMethod;
   
   /**
    * The path for the request.
    */
   char* mPath;
   
   /**
    * The version (major.minor) for the request.
    */
   char* mVersion;
   
public:
   /**
    * Creates a new HttpRequestHeader.
    */
   HttpRequestHeader();
   
   /**
    * Destructs this HttpRequestHeader.
    */
   virtual ~HttpRequestHeader();
   
   /**
    * Parses the start line for this HttpHeader from the passed string.
    * 
    * @param str the string to parse from.
    * @param length the length of the start line (no null character included).
    * 
    * @return true if the start line could be parsed, false if not.
    */
   virtual bool parseStartLine(const char* str, unsigned int length);
   
   /**
    * Gets the start line for this HttpHeader.
    * 
    * @param line the startLine to populate.
    * 
    * @return true if the start line could be parsed, false if not.
    */
   virtual void getStartLine(std::string& line);
   
   /**
    * Returns true if this header has a special start line, false if not.
    * 
    * @return true if this header has a special start line, false if not.
    */
   virtual bool hasStartLine();
   
   /**
    * Sets the HTTP method for the request.
    * 
    * @param method the method for the request (i.e. "GET", "POST").
    */
   virtual void setMethod(const char* method);
   
   /**
    * Gets the HTTP method for the request.
    * 
    * @return the method for the request (i.e. "GET", "POST").
    */
   virtual const char* getMethod();
   
   /**
    * Sets the HTTP version for the request (major.minor).
    * 
    * @param version the version for the request (i.e. "1.0", "1.1").
    */
   virtual void setVersion(const char* version);
   
   /**
    * Gets the HTTP version for the request (major.minor).
    * 
    * @return the version for the request (i.e. "1.0", "1.1").
    */
   virtual const char* getVersion();
   
   /**
    * Sets the path for the request.
    * 
    * @param path the path for the request.
    */
   virtual void setPath(const char* path);
   
   /**
    * Gets the path for the request.
    * 
    * @return the path for the request.
    */
   virtual const char* getPath();
};

} // end namespace http
} // end namespace net
} // end namespace db
#endif

{'fraction_non_alphanumeric': 0.11234002212039816, 'fraction_numerical': 0.005688102385842945, 'mean_word_length': 2.33508956796628, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5436658', 'n_tokens_mistral': 1986, 'n_tokens_neox': 1928, 'n_words': 739}