src/ngx_pagespeed.cc
// We need to get the beacon data to ps_beacon_body_handler so it can pass it
// along to SystemServerContext::HandleBeacon, but it might have been POSTed.
// If it's posted we need to make an async call to get the data, otherwise just
// read it out of the query params.
We need to get the beacon data to ps_beacon_body_handler so it can pass it
along to SystemServerContext::HandleBeacon, but it might have been POSTed.
If it's posted we need to make an async call to get the data, otherwise just
read it out of the query params.
We need to get the beacon data to ps_beacon_body_handler so it can pass it along to SystemServerContext :: HandleBeacon but it might have been POSTed . If it ' s posted we need to make an async call to get the data otherwise just read it out of the query params .
ngx_int_t ps_beacon_handler(ngx_http_request_t* r) {
  if (r->method == NGX_HTTP_POST) {
     See: http:forum.nginx.org/read.php?2,31312,31312
    ngx_int_t rc = ngx_http_read_client_request_body(r, ps_beacon_body_handler);
    if (rc >= NGX_HTTP_SPECIAL_RESPONSE) {
      return rc;
    }
    return NGX_DONE;
  } else {
     Use query params.
    StringPiece query_param_beacon_data;
    ps_query_params_handler(r, &query_param_beacon_data);
    ps_beacon_handler_helper(r, query_param_beacon_data);
    return NGX_HTTP_NO_CONTENT;
  }
}
ngx_int_t ps_beacon_handler ( ngx_http_request_t * r ) { if ( r -> method == NGX_HTTP_POST ) { ngx_int_t rc = ngx_http_read_client_request_body ( r , ps_beacon_body_handler ) ; if ( rc >= NGX_HTTP_SPECIAL_RESPONSE ) { return rc ; } return NGX_DONE ; } else { StringPiece query_param_beacon_data ; ps_query_params_handler ( r , & query_param_beacon_data ) ; ps_beacon_handler_helper ( r , query_param_beacon_data ) ; return NGX_HTTP_NO_CONTENT ; } }
We need to get the beacon data to ps_beacon_body_handler so it can pass it
along to SystemServerContext::HandleBeacon, but it might have been POSTed.
We need to get the beacon data to ps_beacon_body_handler so it can pass it along to SystemServerContext :: HandleBeacon but it might have been POSTed .
// Use post body. Handler functions are called before the request body has // been read from the client, so we need to ask nginx to read it from the // client and then call us back.  Control flow continues in // ps_beacon_body_handler unless there's an error reading the request body. // // See: http://forum.nginx.org/read.php?2,31312,31312 // Use query params.