Skip to content

Commit

Permalink
testresponsebody
Browse files Browse the repository at this point in the history
  • Loading branch information
sc0w committed Feb 7, 2024
1 parent 43bd1ea commit 505d460
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions libcafeweather/weather-bom.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ bom_finish (SoupSession *session, SoupMessage *msg, gpointer data)
return;
}

p = strstr (msg->response_body->data, "Forecast for the rest");
p = strstr (soup_server_message_get_response_body (msg)->data, "Forecast for the rest");
if (p != NULL) {
rp = strstr (p, "The next routine forecast will be issued");
if (rp == NULL)
Expand All @@ -51,7 +51,7 @@ bom_finish (SoupSession *session, SoupMessage *msg, gpointer data)
}

if (info->forecast == NULL)
info->forecast = g_strdup (msg->response_body->data);
info->forecast = g_strdup (soup_server_message_get_response_body (msg)->data);

g_print ("%s\n", info->forecast);
request_done (info, TRUE);
Expand Down
6 changes: 3 additions & 3 deletions libcafeweather/weather-iwin.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ iwin_finish (SoupSession *session, SoupMessage *msg, gpointer data)

g_return_if_fail (info != NULL);

if (!SOUP_STATUS_IS_SUCCESSFUL (soup_message_get_status (msg)) {
if (!SOUP_STATUS_IS_SUCCESSFUL (soup_message_get_status (msg))) {
/* forecast data is not really interesting anyway ;) */
g_warning ("Failed to get IWIN forecast data: %d %s\n",
soup_message_get_status (msg), soup_message_get_reason_phrase (msg));
Expand All @@ -395,9 +395,9 @@ iwin_finish (SoupSession *session, SoupMessage *msg, gpointer data)
}

if (info->forecast_type == FORECAST_LIST)
info->forecast_list = parseForecastXml (msg->response_body->data, info);
info->forecast_list = parseForecastXml (soup_server_message_get_response_body (msg)->data, info);
else
info->forecast = formatWeatherMsg (g_strdup (msg->response_body->data));
info->forecast = formatWeatherMsg (g_strdup (soup_server_message_get_response_body (msg)->data));

request_done (info, TRUE);
}
Expand Down
2 changes: 1 addition & 1 deletion libcafeweather/weather-met.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ met_finish (SoupSession *session, SoupMessage *msg, gpointer data)
return;
}

info->forecast = met_parse (msg->response_body->data);
info->forecast = met_parse (soup_server_message_get_response_body (msg)->data);
request_done (info, TRUE);
}

Expand Down
4 changes: 2 additions & 2 deletions libcafeweather/weather-metar.c
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ metar_finish (SoupSession *session, SoupMessage *msg, gpointer data)
loc = info->location;

searchkey = g_strdup_printf ("<raw_text>%s", loc->code);
p = strstr (msg->response_body->data, searchkey);
p = strstr (soup_server_message_get_response_body (msg)->data, searchkey);
g_free (searchkey);
if (p) {
p += WEATHER_LOCATION_CODE_LEN + 11;
Expand All @@ -522,7 +522,7 @@ metar_finish (SoupSession *session, SoupMessage *msg, gpointer data)
metar = g_strdup (p);
success = metar_parse (metar, info);
g_free (metar);
} else if (!strstr (msg->response_body->data, "aviationweather.gov")) {
} else if (!strstr (soup_server_message_get_response_body (msg)->data, "aviationweather.gov")) {
/* The response doesn't even seem to have come from NOAA...
* most likely it is a wifi hotspot login page. Call that a
* network error.
Expand Down

0 comments on commit 505d460

Please sign in to comment.