Beispiel #1
0
void RFC822HeadersRead(FILE *in,const List *list)
{
  char        *line;
  char        *t;
  struct pair *ppair;
  
  assert(in   != NULL);
  assert(list != NULL);
  
  while((line = RFC822LineRead(in)) != NULL)
  {
    t            = line;
    ppair        = PairNew(&t,':','\0');
    ppair->name  = trim_space(ppair->name);
    ppair->value = trim_space(ppair->value);
    up_string(ppair->name);
    ListAddTail((List *)list,&ppair->node);
    free(line);
  }  
}
Beispiel #2
0
struct pair *CgiNextValue(const Cgi cgi)
{
  struct pair *psp;
  char        *s;
  char        *d;
  
  assert(cgi != NULL);
  
  if (cgi->pbuff >= cgi->pbufend)
    return(NULL);
  if (empty_string(cgi->pbuff))
    return(NULL);

  psp = PairNew(&cgi->pbuff,'=','&');

  for ( d = s = psp->name  ; *s ; *d++ = UrlDecodeChar(&s))
    ;
  *d = '\0';
  for ( d = s = psp->value ; *s ; *d++ = UrlDecodeChar(&s))
    ;
  *d = '\0';

  return(psp);
}