Logo Search packages:      
Sourcecode: sofia-sip version File versions  Download package

SOFIAPUBFUN http_request_t* http_request_create ( su_home_t home,
http_method_t  method,
char const *  name,
url_string_t const *  url,
char const *  version 

Create a request line object.

Create a request line object.

Note that version string is not copied; it MUST remain constant during lifetime of the http_request_t object. You can use constants http_version_1_1 or http_version_1_0 declared in <sofia-sip/http_header.h>.

Definition at line 145 of file http_basic.c.

References MSG_STRING_DUP, http_request_s::rq_method_name, http_request_s::rq_url, http_request_s::rq_version, URL_DUP, url_xtra(), and url_string_t::us_url.

  size_t xtra;
  http_request_t *rq;

  if (method)
    name = http_method_name(method, name);

  if (!name)
    return NULL;

  xtra = url_xtra(url->us_url) + (method ? 0 : strlen(name) + 1);

  rq = (void *)msg_header_alloc(home, http_request_class, (isize_t)xtra);

  if (rq) {
    char *b = (char *)(rq + 1), *end = b + xtra;

    rq->rq_method      = method;
    rq->rq_method_name = name;
    if (!method)
      MSG_STRING_DUP(b, rq->rq_method_name, name);

    URL_DUP(b, end, rq->rq_url, url->us_url);

    rq->rq_version = version ? version : HTTP_VERSION_CURRENT;
    assert(b == end);

  return rq;

Here is the call graph for this function:

Generated by  Doxygen 1.6.0   Back to index