(01-04-2021, 04:27 PM)kent Wrote:(01-04-2021, 01:00 PM)kop316 Wrote: That is right! so what you may need to do (I have had to do this for experiementing) is delete both the .mms/ and mms/ folder in your home folder. That usually cleans up those errors.
Please let me know what you did for getting the proxy!
I put a little hack to do_request() in mmsd/gweb/gweb.c. At ~line 1310, I inserted this:
Code:.
.
if (session->address == NULL)
session->address = g_strdup(session->host);
/* Hack to prevent failure if proxy passed as text host name in */
/* session->address when a numeric IP is needed in this routine */
struct in_addr *inp; // dummy var for return
if(inet_aton(session->address,inp) == 0){
char *hostip;
struct hostent *hp;
debug(web,"session->address:%s not numeric ... trying to resolve host ...",session->address);
hp = gethostbyname(session->address);
if(hp==NULL){
debug(web,"Address host look-up failed.");
free_session(session);
return 0;
} else {
hostip = inet_ntoa( *(struct in_addr*)(hp->h_addr_list[0]));
debug(web,"Ip lookup: %s / %s",session->address,hostip);
session->address = hostip;
debug(web,"New session->address:%s",session->address);
}
}
/* end hack */
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_flags = AI_NUMERICHOST;
.
.
The code immediately following this populates session->addr with an addrinfo structure produced from session->address. The AI_NUMERICHOST flag requires session->address to be a numeric ip address, but whatever logic initially sets up the proxy session assigns the proxy string as provided in simple.c. So proxy would only work if the proxy host was specified as an ip address in simple.c.
My fix checks to see if session->address is in proper IP address format and if not, performs a hostname lookup and replaces the host name with the returned ip address. It works, but I don't really like the solution. If the input specifically *needs* to be a numeric ip address to correctly populate session->addr, the lookup should probably happen where the proxy information is assigned to session->address just like a non-proxy request.
If there *isn't* a specific reason the input needs to be a numeric address here, as best I can tell my fix is functionally redundant to simply commenting out the "hints.ai_flags = AI_NUMERICHOST;" line which would allow the getaddrinfo() call to resolve for either an ip address or text host name. Which, obviously, is a much cleaner solution.
Commenting out the flag did work to get mmsd talking to the proxy, but I'm not sure if changing the way that call works will break something for a different part of the system.
So I altered the simple.c plugin a bit to allow for a config file. Is there any change you could backport the changes you did in gweb.c and impliment it in simple.c? that way the proxy passed into the bearer is now the IP address and there does not have to be a change in the core code.
EDIT: Actually, on second thought, it looks like proxy is set in this function: g_web_set_proxy() . It may make more sense to put that logic there.
EDIT 2: It looks like the proxy is parsed in parse_url. How did you set the proxy? I am wondering if you may need to set it as "http://proxy.mobile.att.net" vs "proxy.mobile.att.net" or something similar like that. It may be worth playing with it a bit to see if your code is even necessary and it may be some sort of parsing error in parse_url() ?