Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

feat(http): support parsing content-type of HTTP request #593

Merged
merged 1 commit into from
Aug 18, 2020

Conversation

neverchanje
Copy link
Contributor

@neverchanje neverchanje commented Aug 14, 2020

rDSN http_server currently ignores entirely the HTTP body, headers, except for URL query-params. Therefore, only URL could be used for the HTTP-client to send arguments.

127.0.0.1/meta/app_envs?name=<app_name> # we can only use query-params as the request's arguments

In order to support serving HTTP post-form ("application/x-www-form-urlencoded") requests, our HTTP server must be able to parse "Content-Type" field in the HTTP header.

~ $ http --form -v POST httpbin.org/post hello=world
POST /post HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 11
Content-Type: application/x-www-form-urlencoded; charset=utf-8 # post-form 
Host: httpbin.org
User-Agent: HTTPie/2.1.0

So in this PR, I add support to parse "Content-Type" in rdsn http_message_parser. The result will be inside msg->buffers[3].

@acelyc111 acelyc111 merged commit 6549c5b into XiaoMi:master Aug 18, 2020
@neverchanje neverchanje added the component/http HTTP/RESTful support label Sep 1, 2020
@neverchanje neverchanje deleted the http-refactor-content-type branch September 1, 2020 02:14
@neverchanje neverchanje added 2.1.0 and removed component/http HTTP/RESTful support labels Mar 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants