Replaced SendResp_upnphttp()+CloseSocket_upnphttp() by SendRespAndClose_upnphttp()
This commit is contained in:
parent
0ff86e4975
commit
24065dbaba
|
@ -1,7 +1,9 @@
|
||||||
$Id: Changelog.txt,v 1.241 2011/11/18 11:10:08 nanard Exp $
|
$Id: Changelog.txt,v 1.242 2011/11/18 11:21:20 nanard Exp $
|
||||||
|
|
||||||
2011/11/18:
|
2011/11/18:
|
||||||
avoid infinite loop in SendResp_upnphttp() in case of error
|
avoid infinite loop in SendResp_upnphttp() in case of error
|
||||||
|
Replaced SendResp_upnphttp() + CloseSocket_upnphttp() by
|
||||||
|
SendRespAndClose_upnphttp()
|
||||||
|
|
||||||
2011/07/30:
|
2011/07/30:
|
||||||
netfilter : Added a tiny_nf_nat.h file to compile with iptables
|
netfilter : Added a tiny_nf_nat.h file to compile with iptables
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: upnphttp.c,v 1.63 2011/11/18 11:10:09 nanard Exp $ */
|
/* $Id: upnphttp.c,v 1.64 2011/11/18 11:21:17 nanard Exp $ */
|
||||||
/* Project : miniupnp
|
/* Project : miniupnp
|
||||||
* Website : http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
* Website : http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
||||||
* Author : Thomas Bernard
|
* Author : Thomas Bernard
|
||||||
|
@ -179,8 +179,7 @@ Send404(struct upnphttp * h)
|
||||||
h->respflags = FLAG_HTML;
|
h->respflags = FLAG_HTML;
|
||||||
BuildResp2_upnphttp(h, 404, "Not Found",
|
BuildResp2_upnphttp(h, 404, "Not Found",
|
||||||
body404, sizeof(body404) - 1);
|
body404, sizeof(body404) - 1);
|
||||||
SendResp_upnphttp(h);
|
SendRespAndClose_upnphttp(h);
|
||||||
CloseSocket_upnphttp(h);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* very minimalistic 501 error message */
|
/* very minimalistic 501 error message */
|
||||||
|
@ -209,8 +208,7 @@ Send501(struct upnphttp * h)
|
||||||
h->respflags = FLAG_HTML;
|
h->respflags = FLAG_HTML;
|
||||||
BuildResp2_upnphttp(h, 501, "Not Implemented",
|
BuildResp2_upnphttp(h, 501, "Not Implemented",
|
||||||
body501, sizeof(body501) - 1);
|
body501, sizeof(body501) - 1);
|
||||||
SendResp_upnphttp(h);
|
SendRespAndClose_upnphttp(h);
|
||||||
CloseSocket_upnphttp(h);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
|
@ -239,8 +237,7 @@ sendDummyDesc(struct upnphttp * h)
|
||||||
" <serviceStateTable />"
|
" <serviceStateTable />"
|
||||||
"</scpd>\r\n";
|
"</scpd>\r\n";
|
||||||
BuildResp_upnphttp(h, xml_desc, sizeof(xml_desc)-1);
|
BuildResp_upnphttp(h, xml_desc, sizeof(xml_desc)-1);
|
||||||
SendResp_upnphttp(h);
|
SendRespAndClose_upnphttp(h);
|
||||||
CloseSocket_upnphttp(h);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -264,8 +261,7 @@ sendXMLdesc(struct upnphttp * h, char * (f)(int *))
|
||||||
{
|
{
|
||||||
BuildResp_upnphttp(h, desc, len);
|
BuildResp_upnphttp(h, desc, len);
|
||||||
}
|
}
|
||||||
SendResp_upnphttp(h);
|
SendRespAndClose_upnphttp(h);
|
||||||
CloseSocket_upnphttp(h);
|
|
||||||
free(desc);
|
free(desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,8 +289,7 @@ ProcessHTTPPOST_upnphttp(struct upnphttp * h)
|
||||||
h->respflags = FLAG_HTML;
|
h->respflags = FLAG_HTML;
|
||||||
BuildResp2_upnphttp(h, 400, "Bad Request",
|
BuildResp2_upnphttp(h, 400, "Bad Request",
|
||||||
err400str, sizeof(err400str) - 1);
|
err400str, sizeof(err400str) - 1);
|
||||||
SendResp_upnphttp(h);
|
SendRespAndClose_upnphttp(h);
|
||||||
CloseSocket_upnphttp(h);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -382,8 +377,7 @@ ProcessHTTPSubscribe_upnphttp(struct upnphttp * h, const char * path)
|
||||||
* If CALLBACK header is missing or does not contain a valid HTTP URL,
|
* If CALLBACK header is missing or does not contain a valid HTTP URL,
|
||||||
* the publisher must respond with HTTP error 412 Precondition Failed*/
|
* the publisher must respond with HTTP error 412 Precondition Failed*/
|
||||||
BuildResp2_upnphttp(h, 412, "Precondition Failed", 0, 0);
|
BuildResp2_upnphttp(h, 412, "Precondition Failed", 0, 0);
|
||||||
SendResp_upnphttp(h);
|
SendRespAndClose_upnphttp(h);
|
||||||
CloseSocket_upnphttp(h);
|
|
||||||
} else {
|
} else {
|
||||||
/* - add to the subscriber list
|
/* - add to the subscriber list
|
||||||
* - respond HTTP/x.x 200 OK
|
* - respond HTTP/x.x 200 OK
|
||||||
|
@ -421,8 +415,7 @@ with HTTP error 412 Precondition Failed. */
|
||||||
BuildResp_upnphttp(h, 0, 0);
|
BuildResp_upnphttp(h, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SendResp_upnphttp(h);
|
SendRespAndClose_upnphttp(h);
|
||||||
CloseSocket_upnphttp(h);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,8 +430,7 @@ ProcessHTTPUnSubscribe_upnphttp(struct upnphttp * h, const char * path)
|
||||||
} else {
|
} else {
|
||||||
BuildResp_upnphttp(h, 0, 0);
|
BuildResp_upnphttp(h, 0, 0);
|
||||||
}
|
}
|
||||||
SendResp_upnphttp(h);
|
SendRespAndClose_upnphttp(h);
|
||||||
CloseSocket_upnphttp(h);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -718,7 +710,7 @@ BuildResp_upnphttp(struct upnphttp * h,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SendResp_upnphttp(struct upnphttp * h)
|
SendRespAndClose_upnphttp(struct upnphttp * h)
|
||||||
{
|
{
|
||||||
char * p;
|
char * p;
|
||||||
ssize_t n;
|
ssize_t n;
|
||||||
|
@ -746,5 +738,6 @@ SendResp_upnphttp(struct upnphttp * h)
|
||||||
len -= n;
|
len -= n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CloseSocket_upnphttp(h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: upnphttp.h,v 1.24 2011/06/27 11:06:00 nanard Exp $ */
|
/* $Id: upnphttp.h,v 1.25 2011/11/18 11:21:18 nanard Exp $ */
|
||||||
/* MiniUPnP project
|
/* MiniUPnP project
|
||||||
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
||||||
* (c) 2006-2011 Thomas Bernard
|
* (c) 2006-2011 Thomas Bernard
|
||||||
|
@ -110,9 +110,9 @@ BuildResp2_upnphttp(struct upnphttp * h, int respcode,
|
||||||
const char * respmsg,
|
const char * respmsg,
|
||||||
const char * body, int bodylen);
|
const char * body, int bodylen);
|
||||||
|
|
||||||
/* SendResp_upnphttp() */
|
/* SendRespAndClose_upnphttp() */
|
||||||
void
|
void
|
||||||
SendResp_upnphttp(struct upnphttp *);
|
SendRespAndClose_upnphttp(struct upnphttp *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: upnpsoap.c,v 1.87 2011/07/15 07:48:26 nanard Exp $ */
|
/* $Id: upnpsoap.c,v 1.88 2011/11/18 11:21:18 nanard Exp $ */
|
||||||
/* MiniUPnP project
|
/* MiniUPnP project
|
||||||
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
||||||
* (c) 2006-2011 Thomas Bernard
|
* (c) 2006-2011 Thomas Bernard
|
||||||
|
@ -53,8 +53,7 @@ BuildSendAndCloseSoapResp(struct upnphttp * h,
|
||||||
memcpy(h->res_buf + h->res_buflen, afterbody, sizeof(afterbody) - 1);
|
memcpy(h->res_buf + h->res_buflen, afterbody, sizeof(afterbody) - 1);
|
||||||
h->res_buflen += sizeof(afterbody) - 1;
|
h->res_buflen += sizeof(afterbody) - 1;
|
||||||
|
|
||||||
SendResp_upnphttp(h);
|
SendRespAndClose_upnphttp(h);
|
||||||
CloseSocket_upnphttp(h);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1864,7 +1863,6 @@ SoapError(struct upnphttp * h, int errCode, const char * errDesc)
|
||||||
syslog(LOG_INFO, "Returning UPnPError %d: %s", errCode, errDesc);
|
syslog(LOG_INFO, "Returning UPnPError %d: %s", errCode, errDesc);
|
||||||
bodylen = snprintf(body, sizeof(body), resp, errCode, errDesc);
|
bodylen = snprintf(body, sizeof(body), resp, errCode, errDesc);
|
||||||
BuildResp2_upnphttp(h, 500, "Internal Server Error", body, bodylen);
|
BuildResp2_upnphttp(h, 500, "Internal Server Error", body, bodylen);
|
||||||
SendResp_upnphttp(h);
|
SendRespAndClose_upnphttp(h);
|
||||||
CloseSocket_upnphttp(h);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue