Menu Home

http

XCode: Use HTTP

XCode 7.0.1 ERROR: App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app’s Info.plist file. You can find this Note at Here. App Transport Security App Transport Security (ATS) enforces best practices in the secure connections between […]

Android install HTTP Cache

// > Android 4.0, 向下兼容 private void enableHttpResponseCache() { try { long cacheSize = 10 * 1024 * 1024; File cacheDir = new File(getCacheDir(), “cache”); Class.forName(“android.net.http.HttpResponseCache”) .getMethod(“install”, File.class, long.class) .invoke(null, httpCacheDir, httpCacheSize); } catch (Exception httpResponseCacheNotAvailable) { } }

linux c 使用socket处理HTTP请求

#include <stdio.h> #include <sys/socket.h> #include <sys/types.h> #include <time.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <netinet/in.h> #include <arpa/inet.h> #include <sys/select.h> #define BUFSIZE 4096 int main(int argc, char **argv) { int sockfd; struct sockaddr_in servaddr; charhttpRequest[BUFSIZE], buf[BUFSIZE]; bzero(httpRequest, sizeof(httpRequest)); //构建请求信息,这里请求http://192.168.2.184:8090/test.flv,这是一个由ffserver搭建的流媒体服务 strcat(httpRequest, “GET /test.flv HTTP/1.1\n”); strcat(httpRequest, “Host: 192.168.2.184:8090\n”); strcat(httpRequest, “User-Agent: Mozilla/5.0 (X11; […]