Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get rid of email.Message, use MultiDict instead #62

Closed
asvetlov opened this issue May 29, 2014 · 22 comments
Closed

Get rid of email.Message, use MultiDict instead #62

asvetlov opened this issue May 29, 2014 · 22 comments

Comments

@asvetlov
Copy link
Member

In private conversation with @fafhrd91 we decided to get rid of using email.Message and switch to MultiDict for HTTP headers and so on.

email.Message handles HTTP headers well but pollutes public API with email specific methods which just doesn't works for aiohttp.

MultiDict implementation will be transplanted from aiorest library, which borrowed the class from WebOb with some cleanup.

The change will break backward compatibility, sorry, but it's strongly required to make aiohttp API clean and safe.

I hope the change will not make intolerable hurt for library users.

@ludovic-gasc
Copy link
Contributor

+10 on this.
It was the first remark I've did myself when I've started to use aiohttp.
About Multidict implementation, I've found a lot in Python librairies, like in werkzeug, django, python-ldap...

@asvetlov
Copy link
Member Author

@GMLudo please take a look on https://github.com/KeepSafe/aiohttp/blob/master/aiohttp/multidict.py and feel free to blame if you will find the implementation doesn't satisfies your requirements.

@ludovic-gasc
Copy link
Contributor

At first look, it's ok for me.
I will test when it will be implemented in aiohttp classes.

@fafhrd91
Copy link
Member

fafhrd91 commented Jun 7, 2014

@asvetlov do you work on this task?
I have some free time, I can integrate multidict.

@asvetlov
Copy link
Member Author

asvetlov commented Jun 7, 2014

@fafhrd91
I'll be busy for next two days, please feel free to move forward.

@fafhrd91
Copy link
Member

fafhrd91 commented Jun 7, 2014

@asvetlov Probably HttpResponse class should not inherit from http.message.HttpMessage class. We can add 'headers' attribute to response, but we need case insensitive multidict

@asvetlov
Copy link
Member Author

asvetlov commented Jun 7, 2014

@fafhrd91 do you really need for case insensitive one?
Can just keeping upper-case header names satisfy your requirements?

@asvetlov
Copy link
Member Author

asvetlov commented Jun 7, 2014

I can implement CIMultiDict and CIMutableMultidict next Monday. Sorry, tomorrow I'll probably not have enough free time.

@fafhrd91
Copy link
Member

fafhrd91 commented Jun 7, 2014

I'll implement. And we need immutable only

@asvetlov
Copy link
Member Author

asvetlov commented Jun 7, 2014

@fafhrd91 I agree with not inheriting HttpResponse from http.message.HttpMessage

@asvetlov
Copy link
Member Author

asvetlov commented Jun 7, 2014

ok

@asvetlov
Copy link
Member Author

asvetlov commented Jun 7, 2014

Also I worry a bit about several Request/Response classes.
We have Response and HttpResponse for example.
High-level server API will need for own Request/Response pair (see aiorest).
That's a mess. Probably good documentation can help.

Ideally I would like to rename:

  • HttpRequest/HttpResponse to ClientRequest/ClientResponse
  • Request/Response to RequestImpl/ResponseImpl (they are part of low-level API)
  • Upcoming high-level pair should be ServerRequest and ServerResponse.

We can keep existing names as aliases to renamed classes.
Thoughts?

@fafhrd91
Copy link
Member

fafhrd91 commented Jun 7, 2014

I like ClientRequest/Response but I don't like RequestImpl.—
Sent from Mailbox

On Sat, Jun 7, 2014 at 12:12 PM, Andrew Svetlov notifications@github.com
wrote:

Also I worry a bit about several Request/Response classes.
We have Response and HttpResponse for example.
High-level server API will need for own Request/Response pair (see aiorest).
That's a mess. Probably good documentation can help.
Ideally I would like to rename:

  • HttpRequest/HttpResponse to ClientRequest/ClientResponse
  • Request/Response to RequestImpl/ResponseImpl (they are part of low-level API)
  • Upcoming high-level pair should be ServerRequest and ServerResponse.
    We can keep existing names as aliases to renamed classes.
    Thoughts?

    Reply to this email directly or view it on GitHub:
    Get rid of email.Message, use MultiDict instead #62 (comment)

@asvetlov
Copy link
Member Author

asvetlov commented Jun 7, 2014

Choose something what you like -- but keep in mind that after adding high level server API we'll need to distinguish current low-level server request/response and upcoming high-level ones.

IIRC we have agreement that current server code will be saved (maybe with some minor changes) and we'll add high-level abstraction on top of current server code.

@fafhrd91
Copy link
Member

fafhrd91 commented Jun 8, 2014

fixed in @6d3050193d31a40e4236ad5e08f0a805aeb6fa06

@fafhrd91 fafhrd91 closed this as completed Jun 8, 2014
@asvetlov
Copy link
Member Author

asvetlov commented Jun 8, 2014

I also would like to use MultiDict in server code.
@fafhrd91 do you have objections?

@fafhrd91
Copy link
Member

fafhrd91 commented Jun 8, 2014

-1 right now. i need to see specs and concerns of ServerRequest/ServerResponse code first. let’s work on this later.

On Jun 8, 2014, at 8:36 AM, Andrew Svetlov notifications@github.com wrote:

I also would like to use MultiDict in server code.
@fafhrd91 do you have objections?


Reply to this email directly or view it on GitHub.

@asvetlov
Copy link
Member Author

asvetlov commented Jun 8, 2014

Ok. Thus we are ready for 0.8 release?

@fafhrd91
Copy link
Member

fafhrd91 commented Jun 8, 2014

Mostly ready, I need to fix logging bug, then I'll make release.—
Sent from Mailbox

On Sun, Jun 8, 2014 at 9:48 AM, Andrew Svetlov notifications@github.com
wrote:

Ok. Thus we are ready for 0.8 release?

Reply to this email directly or view it on GitHub:
#62 (comment)

@fafhrd91
Copy link
Member

fafhrd91 commented Jun 9, 2014

i've decided to migrate to multidict while working on logging code

@asvetlov
Copy link
Member Author

asvetlov commented Jun 9, 2014

Looks like great change! Thank you.

@lock
Copy link

lock bot commented Oct 29, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants