Browse code

Don't use async sockets on Windows

Shawn Webb authored on 2014/05/07 21:06:19
Showing 1 changed files
... ...
@@ -226,8 +226,11 @@ void submit_post(const char *host, const char *port, const char *method, const c
226 226
         encoded = encode_data(postdata);
227 227
         if (!(encoded))
228 228
             return;
229
-
229
+#if defined(_WIN32)
230
+		snprintf(chunkedlen, sizeof(chunkedlen), "%u", strlen(encoded));
231
+#else
230 232
         snprintf(chunkedlen, sizeof(chunkedlen), "%zu", strlen(encoded));
233
+#endif
231 234
         bufsz += sizeof("Content-Type: application/x-www-form-urlencoded\r\n");
232 235
         bufsz += sizeof("Content-Length: \r\n");
233 236
         bufsz += strlen(chunkedlen);
... ...
@@ -253,8 +256,11 @@ void submit_post(const char *host, const char *port, const char *method, const c
253 253
         snprintf(buf+strlen(buf), bufsz-strlen(buf), "%s", encoded);
254 254
         free(encoded);
255 255
     }
256
-
256
+#if defined(_WIN32)
257
+	sockfd = connect_host(host, port, timeout, 0);
258
+#else
257 259
     sockfd = connect_host(host, port, timeout, 1);
260
+#endif
258 261
     if (sockfd < 0) {
259 262
         free(buf);
260 263
         return;