338 |
* @param name Header name to lookup the value for |
* @param name Header name to lookup the value for |
339 |
* @return The value of the specified header, NULL if not found |
* @return The value of the specified header, NULL if not found |
340 |
*/ |
*/ |
341 |
char *get_header(HttpRequest req, const char *name) { |
const char *get_header(HttpRequest req, const char *name) { |
342 |
|
|
343 |
HttpHeader p; |
HttpHeader p; |
344 |
|
|
346 |
|
|
347 |
if(!strcasecmp(p->name, name)) { |
if(!strcasecmp(p->name, name)) { |
348 |
|
|
349 |
return xstrdup(p->value); |
return (p->value); |
350 |
|
|
351 |
} |
} |
352 |
|
|
363 |
* @param name The request parameter key to lookup the value for |
* @param name The request parameter key to lookup the value for |
364 |
* @return The value of the specified parameter, or NULL if not found |
* @return The value of the specified parameter, or NULL if not found |
365 |
*/ |
*/ |
366 |
char *get_parameter(HttpRequest req, const char *name) { |
const char *get_parameter(HttpRequest req, const char *name) { |
367 |
|
|
368 |
HttpParameter p; |
HttpParameter p; |
369 |
|
|
371 |
|
|
372 |
if(!strcasecmp(p->name, name)) { |
if(!strcasecmp(p->name, name)) { |
373 |
|
|
374 |
return xstrdup(p->value); |
return (p->value); |
375 |
|
|
376 |
} |
} |
377 |
|
|
911 |
static int basic_authenticate(HttpRequest req) { |
static int basic_authenticate(HttpRequest req) { |
912 |
|
|
913 |
int rv= FALSE; |
int rv= FALSE; |
914 |
char *credentials= get_header(req, "Authorization"); |
const char *credentials= get_header(req, "Authorization"); |
915 |
|
|
916 |
if(credentials) { |
if(credentials) { |
917 |
|
|
958 |
} |
} |
959 |
|
|
960 |
FREE(cr); |
FREE(cr); |
|
FREE(credentials); |
|
961 |
|
|
962 |
} |
} |
963 |
|
|