juliaweb / httpcommon.jl Goto Github PK
View Code? Open in Web Editor NEWTypes and helper functions for dealing with the HTTP in Julia
License: MIT License
Types and helper functions for dealing with the HTTP in Julia
License: MIT License
julia> using DataFrames, HTTPCommon
Warning: New definition
+(AbstractArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},AbstractArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N}) at operators.jl:376
is ambiguous with:
+(DataArray{T,N},AbstractArray{T,N}) at /Users/Administrator/.julia/v0.3/DataArrays/src/operators.jl:326.
To fix, define
+(DataArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},AbstractArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N})
before the new definition.
Warning: New definition
+(AbstractArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},AbstractArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N}) at operators.jl:376
is ambiguous with:
+(AbstractDataArray{T,N},AbstractArray{T,N}) at /Users/Administrator/.julia/v0.3/DataArrays/src/operators.jl:350.
To fix, define
+(AbstractDataArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},AbstractArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N})
before the new definition.
Warning: New definition
+(AbstractArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},AbstractArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N}) at operators.jl:376
is ambiguous with:
+(AbstractArray{T,N},DataArray{T,N}) at /Users/Administrator/.julia/v0.3/DataArrays/src/operators.jl:326.
To fix, define
+(AbstractArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},DataArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N})
before the new definition.
Warning: New definition
+(AbstractArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},AbstractArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N}) at operators.jl:376
is ambiguous with:
+(AbstractArray{T,N},AbstractDataArray{T,N}) at /Users/Administrator/.julia/v0.3/DataArrays/src/operators.jl:350.
To fix, define
+(AbstractArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},AbstractDataArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N})
before the new definition.
Warning: New definition
-(AbstractArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},AbstractArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N}) at operators.jl:376
is ambiguous with:
-(DataArray{T,N},AbstractArray{T,N}) at /Users/Administrator/.julia/v0.3/DataArrays/src/operators.jl:326.
To fix, define
-(DataArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},AbstractArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N})
before the new definition.
Warning: New definition
-(AbstractArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},AbstractArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N}) at operators.jl:376
is ambiguous with:
-(AbstractArray{T,N},DataArray{T,N}) at /Users/Administrator/.julia/v0.3/DataArrays/src/operators.jl:326.
To fix, define
-(AbstractArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},DataArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N})
before the new definition.
Warning: New definition
-(AbstractArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},AbstractArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N}) at operators.jl:376
is ambiguous with:
-(AbstractDataArray{T,N},AbstractArray{T,N}) at /Users/Administrator/.julia/v0.3/DataArrays/src/operators.jl:350.
To fix, define
-(AbstractDataArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},AbstractArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N})
before the new definition.
Warning: New definition
-(AbstractArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},AbstractArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N}) at operators.jl:376
is ambiguous with:
-(AbstractArray{T,N},AbstractDataArray{T,N}) at /Users/Administrator/.julia/v0.3/DataArrays/src/operators.jl:350.
To fix, define
-(AbstractArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},AbstractDataArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N})
before the new definition.
Warning: New definition
-(AbstractArray{T1<:CalendarTime,N},AbstractArray{T2<:CalendarTime,N}) at operators.jl:376
is ambiguous with:
-(DataArray{T,N},AbstractArray{T,N}) at /Users/Administrator/.julia/v0.3/DataArrays/src/operators.jl:326.
To fix, define
-(DataArray{T1<:CalendarTime,N},AbstractArray{T2<:CalendarTime,N})
before the new definition.
Warning: New definition
-(AbstractArray{T1<:CalendarTime,N},AbstractArray{T2<:CalendarTime,N}) at operators.jl:376
is ambiguous with:
-(AbstractArray{T,N},DataArray{T,N}) at /Users/Administrator/.julia/v0.3/DataArrays/src/operators.jl:326.
To fix, define
-(AbstractArray{T1<:CalendarTime,N},DataArray{T2<:CalendarTime,N})
before the new definition.
Warning: New definition
-(AbstractArray{T1<:CalendarTime,N},AbstractArray{T2<:CalendarTime,N}) at operators.jl:376
is ambiguous with:
-(AbstractDataArray{T,N},AbstractArray{T,N}) at /Users/Administrator/.julia/v0.3/DataArrays/src/operators.jl:350.
To fix, define
-(AbstractDataArray{T1<:CalendarTime,N},AbstractArray{T2<:CalendarTime,N})
before the new definition.
Warning: New definition
-(AbstractArray{T1<:CalendarTime,N},AbstractArray{T2<:CalendarTime,N}) at operators.jl:376
is ambiguous with:
-(AbstractArray{T,N},AbstractDataArray{T,N}) at /Users/Administrator/.julia/v0.3/DataArrays/src/operators.jl:350.
To fix, define
-(AbstractArray{T1<:CalendarTime,N},AbstractDataArray{T2<:CalendarTime,N})
before the new definition.
Warning: requiring "HTTPCommon" did not define a corresponding module.
Currently, FileResponse()
loads the entire file and then constructs and returns a Response
instance. This gets put on the wire in HttpServer.write
.
It would be better to have a streaming implementation of this. I would suggest
Response
gets a write
function which simply outputs the Response.data
FileResponse()
only stores the data it needs to access the fileResponse/FileResponse.write()
get called in HttpServer.write
FileResponse.write
reads from file and write to socket in a streaming fashionIt would not change the API, it would be a purely internal change.
Can I go ahead and work on a PR for this? Does anybody know of a good example for a good and solid (exception handling etc), Julianesque way of streaming read/write?
Thanks!
Nightly coverage runs are dying with:
ERROR: LoadError: TypeError: in Type{...} expression, expected UnionAll, got typeof(Base.Nullable)
Stacktrace:
[1] top-level scope
[2] include at ./boot.jl:283 [inlined]
[3] include_relative(::Module, ::String) at ./loading.jl:503
[4] include(::Module, ::String) at ./sysimg.jl:15
[5] top-level scope
[6] eval at ./boot.jl:286 [inlined]
[7] top-level scope at ./<missing>:2
in expression starting at /home/buildworker/.julia/v0.7/HttpCommon/src/HttpCommon.jl:65
@kshyatt just notifying you so you know what's up with coverage right now
Dep warns have been eliminated for 0.6 would be good to get a release (last tag was May 16)
The PR #47 merged today fails tests due to changes on nightly made since November. I'd submit a PR as a follow-up, but I unfortunately have an issue compiling 0.7 locally. The travis logs point to the two lines that need a change.
I need to send binary data in Request
, but it only accepts Strings
. Would it be hard to change it to HttpData
?
PackageEvaluator.jl is a script that runs nightly. It attempts to load all Julia packages and run their tests (if available) on both the stable version of Julia (0.3) and the nightly build of the unstable version (0.4). The results of this script are used to generate a package listing enhanced with testing results.
Tests pass.
Package doesn't load.
Tests pass.
means that PackageEvaluator found the tests for your package, executed them, and they all passed.
Package doesn't load.
means that PackageEvaluator did not find tests for your package. Additionally, trying to load your package with using
failed.
This issue was filed because your testing status became worse. No additional issues will be filed if your package remains in this state, and no issue will be filed if it improves. If you'd like to opt-out of these status-change messages, reply to this message saying you'd like to and @IainNZ will add an exception. If you'd like to discuss PackageEvaluator.jl please file an issue at the repository. For example, your package may be untestable on the test machine due to a dependency - an exception can be added.
Test log:
>>> 'Pkg.add("HttpCommon")' log
INFO: Installing BinDeps v0.3.0
INFO: Installing Calendar v0.4.2
INFO: Installing FactCheck v0.1.2
INFO: Installing HttpCommon v0.0.5
INFO: Installing ICU v0.4.1
INFO: Installing SHA v0.0.2
INFO: Installing URIParser v0.0.2
INFO: Building ICU
=================================[ ERROR: ICU ]=================================
None of the selected providers can install dependency icu.
Use BinDeps.debug(package_name) to see available providers
while loading /home/idunning/pkgtest/.julia/v0.4/ICU/deps/build.jl, in expression starting on line 28
================================================================================
================================[ BUILD ERRORS ]================================
WARNING: ICU had build errors.
- packages with build errors remain installed in /home/idunning/pkgtest/.julia/v0.4
- build a package and all its dependencies with `Pkg.build(pkg)`
- build a single package by running its `deps/build.jl` script
================================================================================
INFO: Package database updated
>>> 'using HttpCommon' log
ERROR: could not open file /home/idunning/pkgtest/.julia/v0.4/ICU/src/../deps/deps.jl
in include at ./boot.jl:245
in include_from_node1 at ./loading.jl:128
in include at ./boot.jl:245
in include_from_node1 at ./loading.jl:128
in reload_path at loading.jl:152
in _require at loading.jl:67
in require at loading.jl:54
in include at ./boot.jl:245
in include_from_node1 at ./loading.jl:128
in reload_path at loading.jl:152
in _require at loading.jl:67
in require at loading.jl:54
in include at ./boot.jl:245
in include_from_node1 at ./loading.jl:128
in reload_path at loading.jl:152
in _require at loading.jl:67
in require at loading.jl:51
in include at ./boot.jl:245
in include_from_node1 at loading.jl:128
in process_options at ./client.jl:285
in _start at ./client.jl:354
in _start_3B_3500 at /home/idunning/julia04/usr/bin/../lib/julia/sys.so
while loading /home/idunning/pkgtest/.julia/v0.4/ICU/src/ICU.jl, in expression starting on line 54
while loading /home/idunning/pkgtest/.julia/v0.4/Calendar/src/Calendar.jl, in expression starting on line 1
while loading /home/idunning/pkgtest/.julia/v0.4/HttpCommon/src/HttpCommon.jl, in expression starting on line 3
while loading /home/idunning/pkgtest/.julia/v0.4/HttpCommon/testusing.jl, in expression starting on line 1
>>> test log
no tests to run
>>> end of log
The headers() function is used (internally to HttpCommon) for creating a default set of headers for an HTTP response.
headers() = (String => String)[ "Server" => "Julia/$VERSION",
"Content-Type" => "text/html; charset=utf-8",
"Content-Language" => "en",
"Date" => RFC1123_datetime()]
It is also useful externally whenever you'd like to see just one more header or change just one header, but don't really care about the rest. The place where I run into this is with setting the Content-Type (for js/css/etc files). All I need to to change the Content-Type, so I'd like to keep the other defaults. I realize that I can achieve this using HttpCommon.headers(), but I'm wondering if that's discouraged for any reason.
Is there a reason why it's not exported?
Here it says request
has five fields but only four are listed, uri
is missing.
Hi there,
Not sure if this issue belongs here but here it is:
In terminal A I have an app running on localhost with port 50000.
In terminal B I make a request to the app which (among other things) prints req.resource to STDOUT.
The printout ignores the port number.
When I parse req.resource through URIParser and print uri.port, the printed number is "0" rather than 50000. Am I missing something?
Cheers,
Jock
PackageEvaluator.jl is a script that runs nightly. It attempts to load all Julia packages and run their tests (if available) on both the stable version of Julia (0.3) and the nightly build of the unstable version (0.4). The results of this script are used to generate a package listing enhanced with testing results.
Tests pass.
Package doesn't load.
Tests pass.
means that PackageEvaluator found the tests for your package, executed them, and they all passed.
Package doesn't load.
means that PackageEvaluator did not find tests for your package. Additionally, trying to load your package with using
failed.
This issue was filed because your testing status became worse. No additional issues will be filed if your package remains in this state, and no issue will be filed if it improves. If you'd like to opt-out of these status-change messages, reply to this message saying you'd like to and @IainNZ will add an exception. If you'd like to discuss PackageEvaluator.jl please file an issue at the repository. For example, your package may be untestable on the test machine due to a dependency - an exception can be added.
Test log:
>>> 'Pkg.add("HttpCommon")' log
INFO: Installing BinDeps v0.3.0
INFO: Installing Calendar v0.4.2
INFO: Installing FactCheck v0.1.2
INFO: Installing HttpCommon v0.0.5
INFO: Installing ICU v0.4.1
INFO: Installing SHA v0.0.2
INFO: Installing URIParser v0.0.2
INFO: Building ICU
=================================[ ERROR: ICU ]=================================
None of the selected providers can install dependency icu.
Use BinDeps.debug(package_name) to see available providers
while loading /home/idunning/pkgtest/.julia/v0.3/ICU/deps/build.jl, in expression starting on line 28
================================================================================
================================[ BUILD ERRORS ]================================
WARNING: ICU had build errors.
- packages with build errors remain installed in /home/idunning/pkgtest/.julia/v0.3
- build a package and all its dependencies with `Pkg.build(pkg)`
- build a single package by running its `deps/build.jl` script
================================================================================
INFO: Package database updated
INFO: METADATA is out-of-date a you may not have the latest version of HttpCommon
INFO: Use `Pkg.update()` to get the latest versions of your packages
>>> 'using HttpCommon' log
ERROR: could not open file /home/idunning/pkgtest/.julia/v0.3/ICU/src/../deps/deps.jl
in include at ./boot.jl:245
in include_from_node1 at ./loading.jl:128
in include at ./boot.jl:245
in include_from_node1 at ./loading.jl:128
in reload_path at loading.jl:152
in _require at loading.jl:67
in require at loading.jl:54
in include at ./boot.jl:245
in include_from_node1 at ./loading.jl:128
in reload_path at loading.jl:152
in _require at loading.jl:67
in require at loading.jl:54
in include at ./boot.jl:245
in include_from_node1 at ./loading.jl:128
in reload_path at loading.jl:152
in _require at loading.jl:67
in require at loading.jl:51
in include at ./boot.jl:245
in include_from_node1 at loading.jl:128
in process_options at ./client.jl:285
in _start at ./client.jl:354
in _start_3B_1699 at /home/idunning/julia03/usr/bin/../lib/julia/sys.so
while loading /home/idunning/pkgtest/.julia/v0.3/ICU/src/ICU.jl, in expression starting on line 54
while loading /home/idunning/pkgtest/.julia/v0.3/Calendar/src/Calendar.jl, in expression starting on line 1
while loading /home/idunning/pkgtest/.julia/v0.3/HttpCommon/src/HttpCommon.jl, in expression starting on line 3
while loading /home/idunning/pkgtest/.julia/v0.3/HttpCommon/testusing.jl, in expression starting on line 1
>>> test log
no tests to run
>>> end of log
I have implemented file upload control in html file and submitted form with data as multipart/form-data.
I want to read file stream from http request and save it into a file on server. Please help me if any body have solution.
Here's a simple test case (using Morsel):
using Morsel
using HttpServer.parsequerystring
app = Morsel.app()
post(app, "/proc") do req, res
println(parsequerystring(req.http_req.data))
"Result $(parsequerystring(req.http_req.data)) !"
end
start(app, 8000)
Then run:
curl -POST 'http://localhost:8000/proc' -d "name=Jim"
Result on my machine (Mac OS X Mavericks, Julia 0.3.0) is:
Result ["name"=>"Jim\b\0\0\0\0\0\0\0"] !
Make naming of 'HTTP' packages (HTTPClient.jl, HttpServer.jl, HttpParser.jl, and HttpCommon.jl) consistent. Timing to mirror timing of rename of Color.jl to Colors.jl, of HttpServer.jl to HTTPServer.jl, and of HttpParser.jl to HTTPParser.jl.
WARNING: deprecated syntax "{a=>b, ...}" at /Users/Administrator/.julia/v0.4/HttpCommon/src/HttpCommon.jl:93.
Use "Dict{Any,Any}(a=>b, ...)" instead.
WARNING: deprecated syntax "[a=>b, ...]" at /Users/Administrator/.julia/v0.4/HttpCommon/src/HttpCommon.jl:109.
Use "Dict(a=>b, ...)" instead.
WARNING: deprecated syntax "(String=>HttpMethodBitmask)[a=>b, ...]" at /Users/Administrator/.julia/v0.4/HttpCommon/src/HttpCommon.jl:116.
Use "Dict{String,HttpMethodBitmask}(a=>b, ...)" instead.
WARNING: deprecated syntax "[a=>b, ...]" at /Users/Administrator/.julia/v0.4/HttpCommon/src/HttpCommon.jl:136.
Use "Dict(a=>b, ...)" instead.
WARNING: deprecated syntax "(String=>String)[a=>b, ...]" at /Users/Administrator/.julia/v0.4/HttpCommon/src/HttpCommon.jl:139.
Use "Dict{String,String}(a=>b, ...)" instead.
WARNING: deprecated syntax "(String=>String)[]" at /Users/Administrator/.julia/v0.4/HttpCommon/src/HttpCommon.jl:155.
Use "Dict{String,String}()" instead.
WARNING: deprecated syntax "{a,b, ...}" at /Users/Administrator/.julia/v0.4/HttpCommon/src/HttpCommon.jl:196.
Use "Any[a,b, ...]" instead.
WARNING: deprecated syntax "{a,b, ...}" at /Users/Administrator/.julia/v0.4/HttpCommon/src/HttpCommon.jl:196.
Use "Any[a,b, ...]" instead.
WARNING: deprecated syntax "{a=>b, ...}" at /Users/Administrator/.julia/v0.4/HttpCommon/src/mimetypes.jl:981.
Use "Dict{Any,Any}(a=>b, ...)" instead.
Should this be updated with Compat
somehow?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.