OpenVAS Libraries  9.0.3
nasl_http.c File Reference
#include <glib.h>
#include <ctype.h>
#include <string.h>
#include "../misc/prefs.h"
#include "../base/kb.h"
#include "../misc/plugutils.h"
#include "nasl_tree.h"
#include "nasl_global_ctxt.h"
#include "nasl_func.h"
#include "nasl_var.h"
#include "nasl_lex_ctxt.h"
#include "exec.h"
#include "nasl_debug.h"
#include "nasl_socket.h"
#include "nasl_http.h"
#include "../misc/www_funcs.h"
Include dependency graph for nasl_http.c:

Go to the source code of this file.

Macros

#define OPENVAS_USER_AGENT   "Mozilla/5.0 [en] (X11, U; OpenVAS)"
 

Functions

tree_cellhttp_open_socket (lex_ctxt *lexic)
 
tree_cellhttp_close_socket (lex_ctxt *lexic)
 
tree_cellhttp_get (lex_ctxt *lexic)
 
tree_cellhttp_head (lex_ctxt *lexic)
 
tree_cellhttp_post (lex_ctxt *lexic)
 
tree_cellhttp_delete (lex_ctxt *lexic)
 
tree_cellhttp_put (lex_ctxt *lexic)
 
tree_cellcgibin (lex_ctxt *lexic)
 

Macro Definition Documentation

◆ OPENVAS_USER_AGENT

#define OPENVAS_USER_AGENT   "Mozilla/5.0 [en] (X11, U; OpenVAS)"

Function Documentation

◆ cgibin()

tree_cell* cgibin ( lex_ctxt lexic)

Definition at line 265 of file nasl_http.c.

References alloc_tree_cell(), CONST_DATA, prefs_get(), TC::size, TC::str_val, TC::type, and TC::x.

266 {
267  const char *path = prefs_get ("cgi_path");
268  tree_cell *retc;
269 
270  if (path == NULL)
271  path = "/cgi-bin:/scripts";
272  retc = alloc_tree_cell (0, NULL);
273  retc->type = CONST_DATA;
274  retc->x.str_val = g_strdup (path);
275  retc->size = strlen (path);
276 
277  return retc;
278 }
short type
Definition: nasl_tree.h:107
char * str_val
Definition: nasl_tree.h:113
const gchar * prefs_get(const gchar *key)
Get a string preference value via a key.
Definition: prefs.c:86
union TC::@7 x
Definition: nasl_tree.h:105
tree_cell * alloc_tree_cell(int lnb, char *s)
Definition: nasl_tree.c:37
int size
Definition: nasl_tree.h:110
Here is the call graph for this function:

◆ http_close_socket()

tree_cell* http_close_socket ( lex_ctxt lexic)

Definition at line 53 of file nasl_http.c.

References nasl_close_socket().

54 {
55  return nasl_close_socket (lexic);
56 }
tree_cell * nasl_close_socket(lex_ctxt *lexic)
Definition: nasl_socket.c:947
Here is the call graph for this function:

◆ http_delete()

tree_cell* http_delete ( lex_ctxt lexic)

Definition at line 246 of file nasl_http.c.

247 {
248  return _http_req (lexic, "DELETE");
249 }

◆ http_get()

tree_cell* http_get ( lex_ctxt lexic)

Definition at line 214 of file nasl_http.c.

215 {
216  return _http_req (lexic, "GET");
217 }

◆ http_head()

tree_cell* http_head ( lex_ctxt lexic)

Definition at line 226 of file nasl_http.c.

227 {
228  return _http_req (lexic, "HEAD");
229 }

◆ http_open_socket()

tree_cell* http_open_socket ( lex_ctxt lexic)

Definition at line 47 of file nasl_http.c.

References nasl_open_sock_tcp_bufsz().

48 {
49  return nasl_open_sock_tcp_bufsz (lexic, 65536);
50 }
tree_cell * nasl_open_sock_tcp_bufsz(lex_ctxt *lexic, int bufsz)
Definition: nasl_socket.c:426
Here is the call graph for this function:

◆ http_post()

tree_cell* http_post ( lex_ctxt lexic)

Definition at line 237 of file nasl_http.c.

238 {
239  return _http_req (lexic, "POST");
240 }

◆ http_put()

tree_cell* http_put ( lex_ctxt lexic)

Definition at line 255 of file nasl_http.c.

256 {
257  return _http_req (lexic, "PUT");
258 }