MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / do_http_op

Function do_http_op

modules/db_http/http_dbase.c:691–859  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

689 } while (0)
690
691int do_http_op ( const db_con_t* h, const db_key_t* k, const db_op_t* op,
692 const db_val_t* v, const int n, const db_key_t* c, const int nc,
693 const db_key_t* uk, const db_val_t* uv, const int nu,
694 const db_key_t o, const str* custom, db_res_t** r, int db_op )
695
696{
697 LM_DBG("Called with db_op=%d\n",db_op);
698
699 static var_str q = {0,0,0};
700 static var_str buff = {0,0,0};
701 http_conn_t * conn ;
702 int started = 0;
703 int middle_poz;
704 CURLcode ret;
705
706 ret = 0;
707 q.len = 0;
708 buff.len = 0;
709 middle_poz = 0;
710
711 conn = (http_conn_t*) h->tail;
712
713 /* put the http address */
714 CHECK( append_str(&q,conn->start), 0, error);
715
716
717
718 if( h->table->s == NULL)
719 {
720 LM_ERR("No table selected for op\n");
721 goto error;
722 }
723
724 /* put the table name */
725 CHECK( append_str(&q,*h->table), 0, error);
726
727 /* for operations other than querie use POST */
728 if( db_op == HTTPDB_QUERY || db_op == HTTPDB_CUSTOM )
729 {
730 /* put the queries */
731 CHECK( append_const(&q,"/?"), 0, error);
732
733 }
734 else
735 {
736 str tmp;
737 tmp.s="\0";
738 tmp.len = 1;
739 CHECK( append_str(&q,tmp), 0, error);
740 middle_poz = q.len;
741 }
742
743 CHECK( append_keys(&q,"k",k,n,&started), 0, error);
744 CHECK( append_ops(&q,"op",op,n,&started), 0, error);
745 CHECK( append_values(&q,"v",v,n,&started), 0, error);
746 CHECK( append_keys(&q,"c",c,nc,&started), 0, error);
747 CHECK( append_keys(&q,"uk",uk,nu,&started), 0, error);
748 CHECK( append_values(&q,"uv",uv,nu,&started), 0, error);

Callers 7

db_http_queryFunction · 0.85
db_http_raw_queryFunction · 0.85
db_http_insertFunction · 0.85
db_http_deleteFunction · 0.85
db_http_updateFunction · 0.85
db_http_replaceFunction · 0.85
db_insert_updateFunction · 0.85

Calls 7

append_strFunction · 0.85
append_constFunction · 0.85
append_keysFunction · 0.85
append_opsFunction · 0.85
append_valuesFunction · 0.85
url_encodeFunction · 0.85
form_resultFunction · 0.85

Tested by

no test coverage detected