{"cookies","set cookies to be sent in applicable future requests, use newline delimited Set-Cookie HTTP field value syntax",OFFSET(cookies),AV_OPT_TYPE_STRING,{0},0,0,0},
{NULL}
};
#define HTTP_CLASS(flavor)\
...
...
@@ -359,11 +361,117 @@ static int process_line(URLContext *h, char *line, int line_count,
s->is_akamai=1;
}elseif(!av_strcasecmp(tag,"Content-Type")){
av_free(s->mime_type);s->mime_type=av_strdup(p);
}elseif(!av_strcasecmp(tag,"Set-Cookie")){
if(!s->cookies){
if(!(s->cookies=av_strdup(p)))
returnAVERROR(ENOMEM);
}else{
char*tmp=s->cookies;
size_tstr_size=strlen(tmp)+strlen(p)+2;
if(!(s->cookies=av_malloc(str_size))){
s->cookies=tmp;
returnAVERROR(ENOMEM);
}
snprintf(s->cookies,str_size,"%s\n%s",tmp,p);
av_free(tmp);
}
}
}
return1;
}
/**
* Create a string containing cookie values for use as a HTTP cookie header
* field value for a particular path and domain from the cookie values stored in
* the HTTP protocol context. The cookie string is stored in *cookies.
*
* @return a negative value if an error condition occurred, 0 otherwise