- fixed errors occured after intendation command in fsm mechanism

This commit is contained in:
zolliker
2009-02-25 14:50:47 +00:00
parent e762ecb6a1
commit 69af09fe54
14 changed files with 63 additions and 23 deletions

View File

@ -31,7 +31,7 @@ static int configRequest(Ascon * a)
request = CreateDynString(64, 64);
if (request == NULL) {
AsconError(a, "Out of memory", 122);
AsconError(a, "Out of memory", 0);
return 0;
}
DynStringConcat(request, "http://");
@ -44,7 +44,7 @@ static int configRequest(Ascon * a)
ghttp_set_type(pHttp->request, ghttp_type_get);
ghttp_set_header(pHttp->request, "connection", "keep-alive");
if (ghttp_set_uri(pHttp->request, uri) < 0) {
AsconError(a, "Bad URL", a->state);
AsconError(a, "Bad URL", 0);
return 0;
}
if (pHttp->userName != NULL && pHttp->password != NULL) {
@ -68,11 +68,11 @@ static void handleReply(Ascon * a)
pPtr = ghttp_get_body(pHttp->request);
len = ghttp_get_body_len(pHttp->request);
if (strstr(pPtr, "ERROR") != NULL) {
AsconError(a, pPtr, a->state);
AsconError(a, pPtr, 0);
DynStringConcat(a->rdBuffer, pPtr);
} else if (strstr(pPtr, "Authentication Error") != NULL) {
DynStringConcat(a->rdBuffer, pPtr);
AsconError(a, pPtr, a->state);
AsconError(a, pPtr, 0);
} else {
pType = (char *) ghttp_get_header(pHttp->request, "Content-Type");
if (strstr(pType, "sinqhm") == NULL) {
@ -126,7 +126,7 @@ static int HttpHandler(Ascon * a)
status = ghttp_process(pHttp->request);
}
if (status == ghttp_error) {
AsconError(a, "Server error", 123);
AsconError(a, "Server error", 0);
DynStringConcat(a->rdBuffer, "Server error");
a->state = AsconReadDone;
} else {
@ -149,7 +149,7 @@ static int HttpHandler(Ascon * a)
a->state = AsconReading;
} else {
if (DoubleTime() > a->start + a->timeout) {
AsconError(a, " read timeout", 0);
AsconError(a, "read timeout", 0);
a->state = AsconTimeout;
/* this to clear the line */
ghttp_close(pHttp->request);
@ -169,7 +169,7 @@ static int HttpHandler(Ascon * a)
switch (status) {
case ghttp_not_done:
if (DoubleTime() > a->start + a->timeout) {
AsconError(a, " read timeout", 0);
AsconError(a, "read timeout", 0);
a->state = AsconTimeout;
/* this to clear the line */
ghttp_close(pHttp->request);
@ -188,7 +188,7 @@ static int HttpHandler(Ascon * a)
configRequest(a);
status = ghttp_process(pHttp->request);
if (status == ghttp_error) {
AsconError(a, "Server error", a->state);
AsconError(a, "Server error", 0);
DynStringConcat(a->rdBuffer, "Server error");
a->state = AsconReadDone;
}