Skip to content

Instantly share code, notes, and snippets.

@Rukomoynikov
Last active April 22, 2018 00:06
Show Gist options
  • Save Rukomoynikov/1cf0254421e871b195bb5d875e2ce3c5 to your computer and use it in GitHub Desktop.
Save Rukomoynikov/1cf0254421e871b195bb5d875e2ce3c5 to your computer and use it in GitHub Desktop.
Thinknetica HTTP task

Сформируйте и отправьте по указанному выше url:

ncat -C httpbin.org 80
GET /anything HTTP/1.0
Host: httpbin.org

HTTP/1.1 200 OK
Connection: close
Server: meinheld/0.6.1
Date: Sat, 21 Apr 2018 17:15:37 GMT
Content-Type: application/json
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
X-Powered-By: Flask
X-Processed-Time: 0
Content-Length: 246
Via: 1.1 vegur

{
  "args": {}, 
  "data": "", 
  "files": {}, 
  "form": {}, 
  "headers": {
    "Connection": "close", 
    "Host": "httpbin.org"
  }, 
  "json": null, 
  "method": "GET", 
  "origin": "128.204.3.127", 
  "url": "http://httpbin.org/anything"
}
GET /anything?name=maksim HTTP/1.0
Host: httpbin.org
 
HTTP/1.1 200 OK
Connection: close
Server: meinheld/0.6.1
Date: Sat, 21 Apr 2018 17:16:33 GMT
Content-Type: application/json
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
X-Powered-By: Flask
X-Processed-Time: 0
Content-Length: 282
Via: 1.1 vegur

{
  "args": {
    "name": "maksim"
  }, 
  "data": "", 
  "files": {}, 
  "form": {}, 
  "headers": {
    "Connection": "close", 
    "Host": "httpbin.org"
  }, 
  "json": null, 
  "method": "GET", 
  "origin": "128.204.3.127", 
  "url": "http://httpbin.org/anything?name=maksim"
}
POST /anything HTTP/1.0
Host: httpbin.org
Content-Length: 10

text=5

HTTP/1.1 200 OK
Connection: close
Server: meinheld/0.6.1
Date: Sat, 21 Apr 2018 17:18:14 GMT
Content-Type: application/json
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
X-Powered-By: Flask
X-Processed-Time: 0
Content-Length: 290
Via: 1.1 vegur

{
  "args": {}, 
  "data": "text=5\r\n\r\n", 
  "files": {}, 
  "form": {}, 
  "headers": {
    "Connection": "close", 
    "Content-Length": "10", 
    "Host": "httpbin.org"
  }, 
  "json": null, 
  "method": "POST", 
  "origin": "128.204.3.127", 
  "url": "http://httpbin.org/anything"
}
@psylone
Copy link

psylone commented Apr 22, 2018

Обрати внимание на лишние символы возврата каретки и новой строки в теле запроса. Должно быть два отступа новой строки между последним заголовком и телом, но после тела - это не обязательно. Вероятнее всего, это лишнее.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment